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

Method test_lines_single

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

Source from the content-addressed store, hash-verified

577class LineMonitoringTest(MonitoringTestBase, unittest.TestCase):
578
579 def test_lines_single(self):
580 try:
581 self.assertEqual(sys.monitoring._all_events(), {})
582 events = []
583 recorder = RecorderWithDisable(events)
584 sys.monitoring.register_callback(TEST_TOOL, E.LINE, recorder)
585 sys.monitoring.set_events(TEST_TOOL, E.LINE)
586 f1()
587 sys.monitoring.set_events(TEST_TOOL, 0)
588 sys.monitoring.register_callback(TEST_TOOL, E.LINE, None)
589 start = nth_line(LineMonitoringTest.test_lines_single, 0)
590 self.assertEqual(events, [start+7, nth_line(f1, 1), start+8])
591 finally:
592 sys.monitoring.set_events(TEST_TOOL, 0)
593 sys.monitoring.register_callback(TEST_TOOL, E.LINE, None)
594 self.assertEqual(sys.monitoring._all_events(), {})
595 sys.monitoring.restart_events()
596
597 def test_lines_loop(self):
598 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