(self, func, expected, tool=TEST_TOOL)
| 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): |
no test coverage detected