Test the context manager functionality.
(self, timer)
| 54 | timer.stop("nonexistent_label") |
| 55 | |
| 56 | def test_context_manager(self, timer): |
| 57 | """Test the context manager functionality.""" |
| 58 | with timer.time("test_context"): |
| 59 | time.sleep(0.01) # Small sleep to ensure measurable time |
| 60 | |
| 61 | # Check that the timer recorded the measurement |
| 62 | assert "test_context" in timer._timers |
| 63 | assert len(timer._timers["test_context"]) == 1 |
| 64 | |
| 65 | def test_multiple_measurements(self, timer): |
| 66 | """Test recording multiple measurements for the same label.""" |