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

Method test_addError

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

Source from the content-addressed store, hash-verified

342 # methods. Contains formatted tracebacks instead
343 # of sys.exc_info() results."
344 def test_addError(self):
345 class Foo(unittest.TestCase):
346 def test_1(self):
347 pass
348
349 test = Foo('test_1')
350 try:
351 raise TypeError()
352 except TypeError:
353 exc_info_tuple = sys.exc_info()
354
355 result = unittest.TestResult()
356
357 result.startTest(test)
358 result.addError(test, exc_info_tuple)
359 result.stopTest(test)
360
361 self.assertFalse(result.wasSuccessful())
362 self.assertEqual(len(result.errors), 1)
363 self.assertEqual(len(result.failures), 0)
364 self.assertEqual(result.testsRun, 1)
365 self.assertEqual(result.shouldStop, False)
366
367 test_case, formatted_exc = result.errors[0]
368 self.assertIs(test_case, test)
369 self.assertIsInstance(formatted_exc, str)
370
371 def test_addError_locals(self):
372 class Foo(unittest.TestCase):

Callers

nothing calls this directly

Calls 10

startTestMethod · 0.95
addErrorMethod · 0.95
stopTestMethod · 0.95
wasSuccessfulMethod · 0.95
lenFunction · 0.85
assertFalseMethod · 0.80
assertIsInstanceMethod · 0.80
FooClass · 0.70
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected