MCPcopy Index your code
hub / github.com/python/cpython / test_enterContext

Method test_enterContext

Lib/test/test_unittest/test_runner.py:221–235  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

219
220
221 def test_enterContext(self):
222 class TestableTest(unittest.TestCase):
223 def testNothing(self):
224 pass
225
226 test = TestableTest('testNothing')
227 cleanups = []
228
229 test.addCleanup(cleanups.append, 'cleanup1')
230 cm = TestCM(cleanups, 42)
231 self.assertEqual(test.enterContext(cm), 42)
232 test.addCleanup(cleanups.append, 'cleanup2')
233
234 self.assertTrue(test.doCleanups())
235 self.assertEqual(cleanups, ['enter', 'cleanup2', 'exit', 'cleanup1'])
236
237 def test_enterContext_arg_errors(self):
238 class TestableTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 7

addCleanupMethod · 0.80
enterContextMethod · 0.80
assertTrueMethod · 0.80
doCleanupsMethod · 0.80
TestableTestClass · 0.70
TestCMClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected