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

Method test_cause

Lib/test/test_traceback.py:2356–2368  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2354 self.assertIn('1/0 # Marker', lines[2])
2355
2356 def test_cause(self):
2357 def inner_raise():
2358 try:
2359 self.zero_div()
2360 except ZeroDivisionError as e:
2361 raise KeyError from e
2362 def outer_raise():
2363 inner_raise() # Marker
2364 blocks = boundaries.split(self.get_report(outer_raise))
2365 self.assertEqual(len(blocks), 3)
2366 self.assertEqual(blocks[1], cause_message)
2367 self.check_zero_div(blocks[0])
2368 self.assertIn('inner_raise() # Marker', blocks[2])
2369
2370 def test_context(self):
2371 def inner_raise():

Callers

nothing calls this directly

Calls 5

check_zero_divMethod · 0.95
assertInMethod · 0.80
splitMethod · 0.45
get_reportMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected