Add edge case tests for prompt validation (fixes #316)
Description
Fixes #316
This PR adds three new edge case tests to improve test coverage for the prompt validation module, addressing gaps in error handling and boundary condition testing.
Problem
The prompt validation test suite lacks coverage for important edge cases that could cause unexpected behavior in production:
- Empty extraction text handling
- Unicode characters and special symbols (café, °F, etc.)
- Very long extraction text (1000+ characters)
Proposed Solution
Add three new test cases to tests/prompt_validation_test.py:
test_empty_extraction_text()- Verify that empty strings are properly rejected with ValueErrortest_unicode_and_special_chars()- Ensure proper handling of unicode characterstest_very_long_extraction_text()- Test graceful handling of very long extractions
Benefits
- ✅ Improves reliability by catching edge case bugs early
- ✅ Better test coverage for error handling paths
- ✅ Documents expected behavior for edge cases
- ✅ Follows existing test patterns and conventions
How Has This Been Tested?
All three tests pass successfully:
python -m pytest tests/prompt_validation_test.py::PromptAlignmentValidationTest::test_empty_extraction_text -v
python -m pytest tests/prompt_validation_test.py::PromptAlignmentValidationTest::test_unicode_and_special_chars -v
python -m pytest tests/prompt_validation_test.py::PromptAlignmentValidationTest::test_very_long_extraction_text -v
Result: 3 passed ✅
Full test suite:
python -m pytest tests/prompt_validation_test.py -v
Result: 395 passed, 77 warnings ✅
Testing environment:
- OS: Windows 11
- Python: 3.13.3
- Branch: Open-Soruce-Contribution
Checklist
- [x] Code follows project style
- [x] Self-review completed
- [x] Tests added
- [x] All tests pass
- [x] Focused single change
- [x] Linked to issue #316
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
⚠️ Branch Update Required
Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 7 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 8 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 11 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 15 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 22 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 29 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 29 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 31 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 36 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 36 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 36 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 36 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 36 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 36 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.
⚠️ Branch Update Required
Your branch is 39 commits behind main. Please update your branch to ensure CI checks run with the latest code:
git fetch origin main
git merge origin/main
git push
Note: Enable "Allow edits by maintainers" to allow automatic updates.