tests: cover schemas helpers, sanitizer gaps, prompt log_context branch#322
Open
JayDS22 wants to merge 1 commit intojenkinsci:mainfrom
Open
tests: cover schemas helpers, sanitizer gaps, prompt log_context branch#322JayDS22 wants to merge 1 commit intojenkinsci:mainfrom
JayDS22 wants to merge 1 commit intojenkinsci:mainfrom
Conversation
New file tests/unit/models/test_schemas.py (22 tests): is_valid_query_type, str_to_query_type, try_str_to_query_type, ChatRequest validator, ChatRequestWithFiles validator. Appended to tests/unit/prompts/test_prompt_builder.py (3 tests): build_prompt() with log_context was completely untested. Appended to tests/unit/tools/test_sanitizer.py (5 tests): Bearer, GitHub PAT, PEM key block, client_secret, api_key patterns existed in sanitizer.py but had no 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.
Adds 30 unit tests covering previously-untested code.
Fixes #321
tests/unit/models/test_schemas.py(22 tests, new file)is_valid_query_type- valid members, case sensitivity, empty stringstr_to_query_type- valid conversion, ValueError on bad inputtry_str_to_query_type- fallback to MULTI on bad inputChatRequest- accepts valid messages, rejects empty/whitespaceChatRequestWithFiles- message-only, files-only, both, neithertests/unit/prompts/test_prompt_builder.py(3 tests appended)log_contextprovided usesLOG_ANALYSIS_INSTRUCTIONand includes log datalog_context=Noneuses standardSYSTEM_INSTRUCTION, no log sectiontests/unit/tools/test_sanitizer.py(5 tests appended)ghp_), PEM private key block,client_secret,api_keywith colonHow to run:
All 38 tests pass (30 new + 8 existing). No source changes, no new deps.