| 2280 | _testcapi.monitoring_exit_scope() |
| 2281 | |
| 2282 | def setUp(self): |
| 2283 | super(TestCApiEventGeneration, self).setUp() |
| 2284 | |
| 2285 | capi = _testcapi |
| 2286 | |
| 2287 | self.codelike = capi.CodeLike(2) |
| 2288 | |
| 2289 | self.cases = [ |
| 2290 | # (Event, function, *args) |
| 2291 | ( 1, E.PY_START, capi.fire_event_py_start), |
| 2292 | ( 1, E.PY_RESUME, capi.fire_event_py_resume), |
| 2293 | ( 1, E.PY_YIELD, capi.fire_event_py_yield, 10), |
| 2294 | ( 1, E.PY_RETURN, capi.fire_event_py_return, 20), |
| 2295 | ( 2, E.CALL, capi.fire_event_call, callable, 40), |
| 2296 | ( 1, E.JUMP, capi.fire_event_jump, 60), |
| 2297 | ( 1, E.BRANCH_RIGHT, capi.fire_event_branch_right, 70), |
| 2298 | ( 1, E.BRANCH_LEFT, capi.fire_event_branch_left, 80), |
| 2299 | ( 1, E.PY_THROW, capi.fire_event_py_throw, ValueError(1)), |
| 2300 | ( 1, E.RAISE, capi.fire_event_raise, ValueError(2)), |
| 2301 | ( 1, E.EXCEPTION_HANDLED, capi.fire_event_exception_handled, ValueError(5)), |
| 2302 | ( 1, E.PY_UNWIND, capi.fire_event_py_unwind, ValueError(6)), |
| 2303 | ( 1, E.STOP_ITERATION, capi.fire_event_stop_iteration, 7), |
| 2304 | ( 1, E.STOP_ITERATION, capi.fire_event_stop_iteration, StopIteration(8)), |
| 2305 | ] |
| 2306 | |
| 2307 | self.EXPECT_RAISED_EXCEPTION = [E.PY_THROW, E.RAISE, E.EXCEPTION_HANDLED, E.PY_UNWIND] |
| 2308 | |
| 2309 | |
| 2310 | def check_event_count(self, event, func, args, expected, callback_raises=None): |