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

Method test_lines_two

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

Source from the content-addressed store, hash-verified

612 sys.monitoring.restart_events()
613
614 def test_lines_two(self):
615 try:
616 self.assertEqual(sys.monitoring._all_events(), {})
617 events = []
618 recorder = RecorderWithDisable(events)
619 events2 = []
620 recorder2 = RecorderWithDisable(events2)
621 sys.monitoring.register_callback(TEST_TOOL, E.LINE, recorder)
622 sys.monitoring.register_callback(TEST_TOOL2, E.LINE, recorder2)
623 sys.monitoring.set_events(TEST_TOOL, E.LINE); sys.monitoring.set_events(TEST_TOOL2, E.LINE)
624 f1()
625 sys.monitoring.set_events(TEST_TOOL, 0); sys.monitoring.set_events(TEST_TOOL2, 0)
626 sys.monitoring.register_callback(TEST_TOOL, E.LINE, None)
627 sys.monitoring.register_callback(TEST_TOOL2, E.LINE, None)
628 start = nth_line(LineMonitoringTest.test_lines_two, 0)
629 expected = [start+10, nth_line(f1, 1), start+11]
630 self.assertEqual(events, expected)
631 self.assertEqual(events2, expected)
632 finally:
633 sys.monitoring.set_events(TEST_TOOL, 0)
634 sys.monitoring.set_events(TEST_TOOL2, 0)
635 sys.monitoring.register_callback(TEST_TOOL, E.LINE, None)
636 sys.monitoring.register_callback(TEST_TOOL2, E.LINE, None)
637 self.assertEqual(sys.monitoring._all_events(), {})
638 sys.monitoring.restart_events()
639
640 def check_lines(self, func, expected, tool=TEST_TOOL):
641 try:

Callers

nothing calls this directly

Calls 6

RecorderWithDisableClass · 0.85
f1Function · 0.85
nth_lineFunction · 0.85
assertEqualMethod · 0.45
register_callbackMethod · 0.45
restart_eventsMethod · 0.45

Tested by

no test coverage detected