Add comprehensive unit tests for accounting module#11
Open
joshgreaves wants to merge 1 commit intomainfrom
Open
Add comprehensive unit tests for accounting module#11joshgreaves wants to merge 1 commit intomainfrom
joshgreaves wants to merge 1 commit intomainfrom
Conversation
Implemented unit tests for the accounting module covering: - `martian_cost_list` function: Tests for successful fetching, caching behavior, error handling (HTTP errors, network errors, invalid JSON), and default client creation - `get_llm_cost` function: Tests for basic cost calculation, request charges, decimal precision, error handling (missing model, missing usage), None pricing fields, zero tokens, and large token counts The tests use mocking to avoid external API calls and verify correct behavior across various scenarios including edge cases and error conditions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
accounting.pymodulemartian_cost_listandget_llm_costfunctions with extensive edge case coverageWhat's Included
martian_cost_listfunction tests:get_llm_costfunction tests:Testing Approach
pytestfor test executionTest Coverage
The new test file
src/ares/llms/accounting_test.pycontains 18 test cases across 2 test classes, providing thorough coverage of both happy paths and error scenarios.🤖 Generated with Claude Code
Generated description
Adds comprehensive unit tests for the
accountingmodule, which is responsible for tracking and calculating costs for LLM operations within thearessystem. Validates themartian_cost_listfunction for fetching model pricing and theget_llm_costfunction for calculating LLM usage costs.Latest Contributors(0)