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