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

Method check_lines

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

Source from the content-addressed store, hash-verified

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

Callers 4

test_linearMethod · 0.95
test_branchMethod · 0.95
test_try_exceptMethod · 0.95

Calls 3

RecorderWithDisableClass · 0.85
funcFunction · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected