[kimi] Add comprehensive unit tests for models/budget.py (#1316) #1347

Merged
kimi merged 1 commits from kimi/issue-1316 into main 2026-03-24 02:48:51 +00:00

1 Commits

Author SHA1 Message Date
kimi
a7da45e788 test: Add comprehensive unit tests for models/budget.py (#1316)
Some checks failed
Tests / lint (pull_request) Failing after 39s
Tests / test (pull_request) Has been skipped
Fixes #1316

Adds 58 unit tests covering:
- SpendRecord dataclass functionality
- estimate_cost_usd() for all model types (Claude, GPT-4o, Grok)
- BudgetTracker initialization with memory/file DB
- Budget tracking and accumulation
- Daily/monthly spend queries and isolation
- Cloud budget limit enforcement (daily, monthly, both)
- Budget summary generation with all status flags
- In-memory fallback when DB is unavailable
- Thread-safe concurrent spend recording
- Edge cases: zero/negative costs, empty names, very small/large values
- Singleton get_budget_tracker() behavior
2026-03-23 22:47:55 -04:00