MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_addTests

Method test_addTests

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

Source from the content-addressed store, hash-verified

269 # "This is equivalent to iterating over tests, calling addTest() for
270 # each element"
271 def test_addTests(self):
272 class Foo(unittest.TestCase):
273 def test_1(self): pass
274 def test_2(self): pass
275
276 test_1 = Foo('test_1')
277 test_2 = Foo('test_2')
278 inner_suite = unittest.TestSuite([test_2])
279
280 def gen():
281 yield test_1
282 yield test_2
283 yield inner_suite
284
285 suite_1 = unittest.TestSuite()
286 suite_1.addTests(gen())
287
288 self.assertEqual(list(suite_1), list(gen()))
289
290 # "This is equivalent to iterating over tests, calling addTest() for
291 # each element"
292 suite_2 = unittest.TestSuite()
293 for t in gen():
294 suite_2.addTest(t)
295
296 self.assertEqual(suite_1, suite_2)
297
298 # "Add all the tests from an iterable of TestCase and TestSuite
299 # instances to this test suite."

Callers

nothing calls this directly

Calls 6

listClass · 0.85
addTestsMethod · 0.80
addTestMethod · 0.80
FooClass · 0.70
genFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected