MCPcopy Create free account
hub / github.com/python/cpython / test_addTest__TestSuite

Method test_addTest__TestSuite

Lib/test/test_unittest/test_suite.py:252–265  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

250
251 # "Add a ... TestSuite to the suite"
252 def test_addTest__TestSuite(self):
253 class Foo(unittest.TestCase):
254 def test(self): pass
255
256 suite_2 = unittest.TestSuite([Foo('test')])
257
258 suite = unittest.TestSuite()
259 suite.addTest(suite_2)
260
261 self.assertEqual(suite.countTestCases(), 1)
262 self.assertEqual(list(suite), [suite_2])
263 # countTestCases() still works after tests are run
264 suite.run(unittest.TestResult())
265 self.assertEqual(suite.countTestCases(), 1)
266
267 # "Add all the tests from an iterable of TestCase and TestSuite
268 # instances to this test suite."

Callers

nothing calls this directly

Calls 6

runMethod · 0.95
listClass · 0.85
addTestMethod · 0.80
FooClass · 0.70
assertEqualMethod · 0.45
countTestCasesMethod · 0.45

Tested by

no test coverage detected