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

Method assertCleanError

Lib/test/test_ipaddress.py:43–56  ·  view source on GitHub ↗

Ensure exception does not display a context by default Wraps unittest.TestCase.assertRaisesRegex

(self, exc_type, details, *args)

Source from the content-addressed store, hash-verified

41
42 @contextlib.contextmanager
43 def assertCleanError(self, exc_type, details, *args):
44 """
45 Ensure exception does not display a context by default
46
47 Wraps unittest.TestCase.assertRaisesRegex
48 """
49 if args:
50 details = details % args
51 cm = self.assertRaisesRegex(exc_type, details)
52 with cm as exc:
53 yield exc
54 # Ensure we produce clean tracebacks on failure
55 if exc.exception.__context__ is not None:
56 self.assertTrue(exc.exception.__suppress_context__)
57
58 def assertAddressError(self, details, *args):
59 """Ensure a clean AddressValueError"""

Callers 3

assertAddressErrorMethod · 0.95
assertNetmaskErrorMethod · 0.95
assertFactoryErrorMethod · 0.80

Calls 2

assertRaisesRegexMethod · 0.80
assertTrueMethod · 0.80

Tested by

no test coverage detected