test: add ~60 tests to improve coverage from 65% - #11
Merged
Conversation
New test files: - test_prompt.py: build_context() and build_messages() all branches - test_chain.py: rag_generate success, RuntimeError, prompt assembly - test_base_provider.py: _is_retryable() all branches, generate() paths - test_bootstrap.py: _create_provider, _create_strategy, build_llm_service - test_provider_implementations.py: Claude/Gemini/OpenRouter with mocked SDKs Extended existing tests: - test_service.py: generic Exception, Untitled fallback, topic_id, None scalar - test_resilient_service.py: generic exception fallback, mixed failures, ProviderHandler acquire+record flow - test_rate_limit.py: rpd=0, empty window, RPM/TPM full wait - test_chat.py (routers): user_id/topic_id/article_id passthrough, 503, set_llm_service Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Gemini tests: use @patch decorator instead of with-block so mock persists through asyncio.to_thread (genai.GenerateContentConfig was unmocked when the thread ran) - sliding_window_strategy._tpm_wait: handle empty deque when a single request exceeds TPM — return 0 instead of IndexError Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Test Coverage
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
New test files:
Extended existing tests: