def test_countTestCases_nested(self):
class Test1(unittest2.TestCase):
def test1(self): pass
def test2(self): pass
test2 = unittest2.FunctionTestCase(lambda: None)
test3 = unittest2.FunctionTestCase(lambda: None)
child = unittest2.TestSuite((Test1('test2'), test2))
parent = unittest2.TestSuite((test3, child, Test1('test1')))
self.assertEqual(parent.countTestCases(), 4)
# countTestCases() still works after tests are run
parent.run(unittest.TestResult())
self.assertEqual(parent.countTestCases(), 4)
self.assertEqual(child.countTestCases(), 2)
# "Run the tests associated with this suite, collecting the result into
# the test result object passed as result."
#
# And if there are no tests? What then?
test_suite.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录