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

Method check_lines

Lib/test/test_monitoring.py:640–653  ·  view source on GitHub ↗
(self, func, expected, tool=TEST_TOOL)

Source from the content-addressed store, hash-verified

638 sys.monitoring.restart_events()
639
640 def check_lines(self, func, expected, tool=TEST_TOOL):
641 try:
642 self.assertEqual(sys.monitoring._all_events(), {})
643 events = []
644 recorder = RecorderWithDisable(events)
645 sys.monitoring.register_callback(tool, E.LINE, recorder)
646 sys.monitoring.set_events(tool, E.LINE)
647 func()
648 sys.monitoring.set_events(tool, 0)
649 sys.monitoring.register_callback(tool, E.LINE, None)
650 lines = [ line - func.__code__.co_firstlineno for line in events[1:-1] ]
651 self.assertEqual(lines, expected)
652 finally:
653 sys.monitoring.set_events(tool, 0)
654
655
656 def test_linear(self):

Callers 4

test_linearMethod · 0.95
test_branchMethod · 0.95
test_try_exceptMethod · 0.95

Calls 4

RecorderWithDisableClass · 0.85
funcFunction · 0.70
assertEqualMethod · 0.45
register_callbackMethod · 0.45

Tested by

no test coverage detected