(self)
| 40 | assert blocked.blocked_by == "session" |
| 41 | |
| 42 | def test_hourly_limit(self) -> None: |
| 43 | clock = _FakeClock(1000.0) |
| 44 | sc = SpendControl(storage=InMemorySpendControlStorage(), now_fn=clock) |
| 45 | sc.set_limit("hourly", 2.00) |
| 46 | |
| 47 | sc.record(1.50, model="model-a") |
| 48 | assert sc.check(0.40).allowed is True |
| 49 | assert sc.check(0.60).allowed is False |
| 50 | |
| 51 | # Advance 1 hour → window resets |
| 52 | clock.advance(3601) |
| 53 | assert sc.check(2.00).allowed is True |
| 54 | |
| 55 | def test_daily_limit(self) -> None: |
| 56 | clock = _FakeClock(1000.0) |
nothing calls this directly
no test coverage detected