import unittest
class TestCase2(unittest.TestCase):
def test_case_01(self):
self.assertTrue(1)
def test_case_02(self):
self.assertTrue(0)
def test_case_03(self):
self.assertTrue(0)
def my_case_01(self):
self.assertTrue(1)
def my_case_02(self):
self.assertTrue(1)
if __name__ == '__main__':
suite = unittest.makeSuite(testCaseClass=TestCase2, prefix="test")
suite.addTests(map(TestCase2, ["my_case_01", "my_case_02"]))
# 容器中有几个用例
print(333, suite.countTestCases())
# 执行器:
unittest.TextTestRunner().run(suite)