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

Method test_throw

Lib/test/test_monitoring.py:1025–1048  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1023 recorders = self.exception_recorders)
1024
1025 def test_throw(self):
1026
1027 def gen():
1028 yield 1
1029 yield 2
1030
1031 def func():
1032 try:
1033 g = gen()
1034 next(g)
1035 g.throw(IndexError)
1036 except IndexError:
1037 pass
1038
1039 self.check_balanced(
1040 func,
1041 recorders = self.exception_recorders)
1042
1043 events = self.get_events(
1044 func,
1045 TEST_TOOL,
1046 self.exception_recorders + (ThrowRecorder,)
1047 )
1048 self.assertEqual(events[0], ("throw", IndexError))
1049
1050 @requires_specialization
1051 def test_no_unwind_for_shim_frame(self):

Callers

nothing calls this directly

Calls 3

check_balancedMethod · 0.80
get_eventsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected