diff --git a/.github/time/test_time.py b/.github/time/test_time.py index c0b8d57..04d3bdb 100644 --- a/.github/time/test_time.py +++ b/.github/time/test_time.py @@ -1047,15 +1047,14 @@ fresh82() assert tm.allowance(credit, NOW) == 3.0, "$30 over 10 days" fresh82(spent_row(1), spent_row(1)); assert not refused("anthropic") fresh82(spent_row(1), spent_row(1), spent_row(1)); assert refused("anthropic"), "the fourth dollar" -assert "pool credits has spent $3.00 of its $3.00 allowance" in str(__import__("contextlib").suppress) or True nxt = NOW + dt.timedelta(days=1) fresh82(spent_row(3)) # a day passes: yesterday's $3 is spent, $27 over 9 days assert tm.allowance(credit, nxt) == 3.0 and not refused("anthropic", nxt) fresh82(); assert tm.allowance(credit, nxt) == 30 / 9 > 3, "a quiet day raises the share" os.environ["TIME_PACE"] = "0.8"; assert abs(tm.allowance(credit, NOW) - 2.4) < 1e-9; os.environ.pop("TIME_PACE") -fresh82(spent_row(3.5)); tm.slack = lambda: 1.5 +real_slack = tm.slack; fresh82(spent_row(3.5)); tm.slack = lambda: 1.5 assert not refused("anthropic"), "a run under way may go over, against the pool's allowance" -fresh82(spent_row(4.5)); assert refused("anthropic"); del tm.slack +fresh82(spent_row(4.5)); assert refused("anthropic"); tm.slack = real_slack # a window pool refuses once the window is spent and allows again after its reset fresh82(spent_row(2, "venice")); assert refused("venice") assert not refused("venice", tm.window_bounds("hours:5", NOW)[1] + dt.timedelta(minutes=1)), "new window" @@ -1071,8 +1070,7 @@ out = io.StringIO() with contextlib.redirect_stdout(out): tm.cmd_doctor() assert "pool `credits` | expiring, $30.00; spent $1.00 since reset; next reset " in out.getvalue() and "allowance today $3.00" in out.getvalue(), out.getvalue() assert "pool `sub` | window, $2.00; spent $0.00" in out.getvalue() -import astra as ast -assert ast.board.__code__ and tm.pool_spent(credit) == 1 and tm.pool_spent(sub_) == 0 +assert tm.pool_spent(credit) == 1 and tm.pool_spent(sub_) == 0 tm.pools = real_pools; os.environ.pop("TIME_DAILY_USD"); tm.LEDGER.clear(); tm._ledger_files.clear() print("ALL OK 82")