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

Method test_lines_single

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

Source from the content-addressed store, hash-verified

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