MCPcopy
hub / github.com/NVIDIA-NeMo/RL / test_context_manager

Method test_context_manager

tests/unit/utils/test_timer.py:56–63  ·  view source on GitHub ↗

Test the context manager functionality.

(self, timer)

Source from the content-addressed store, hash-verified

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."""

Callers

nothing calls this directly

Calls 2

timeMethod · 0.80
sleepMethod · 0.45

Tested by

no test coverage detected