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

Method test_addError_locals

Lib/test/test_unittest/test_result.py:367–384  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

365 self.assertIsInstance(formatted_exc, str)
366
367 def test_addError_locals(self):
368 class Foo(unittest.TestCase):
369 def test_1(self):
370 1/0
371
372 test = Foo('test_1')
373 result = unittest.TestResult()
374 result.tb_locals = True
375
376 unittest.result.traceback = MockTraceback
377 self.addCleanup(restore_traceback)
378 result.startTestRun()
379 test.run(result)
380 result.stopTestRun()
381
382 self.assertEqual(len(result.errors), 1)
383 test_case, formatted_exc = result.errors[0]
384 self.assertEqual('A tracebacklocals', formatted_exc)
385
386 def test_addSubTest(self):
387 class Foo(unittest.TestCase):

Callers

nothing calls this directly

Calls 6

startTestRunMethod · 0.95
runMethod · 0.95
stopTestRunMethod · 0.95
addCleanupMethod · 0.80
FooClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected