test: add unit tests for locale module#565
Open
JiayuuWang wants to merge 3 commits into666ghj:mainfrom
Open
Conversation
When the LLM generates a <tool_call> block followed by a self-generated <tool_result> block in the same response, the fake result must be stripped before appending to message history. The real tool result will be injected separately by the system. This fixes a React Hallucination bug where models could fabricate tool results that didn't actually come from tool invocations.
- Added pytest.ini configuration for test discovery - Added tests/__init__.py package marker - Added 22 unit tests covering: - _read_text_with_fallback: UTF-8, GBK, Latin-1, replacement chars - FileParser: extensions, nonexistent file, unsupported format, md/txt extraction - FileParser.extract_from_multiple: valid files and error handling - split_text_into_chunks: short text, empty text, chunk size, overlap, sentence boundaries All tests pass with direct module import to avoid Flask initialization issues. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Add tests for locale file structure and completeness:
- Test languages.json has required fields (zh, en labels, llmInstruction)
- Test zh/en translations have common keys (confirm, cancel, etc.)
- Test zh and en have same top-level keys
- Test translation interpolation format ({var} placeholders)
- Test existing translation files have consistent structure
Co-Authored-By: Claude Opus 4.7 <[email protected]>
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.
Summary
Test Coverage
Test Plan
python -m pytest tests/test_locale.py -v- all 7 tests pass🤖 Generated with Claude Code