MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_lines_two

Method test_lines_two

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected