test: improve test coverage to exceed 80% target#5
Merged
Conversation
Added 8 new tests: search.py CLI (59% → expected ~75%): - test_search_with_married_name - married name search - test_search_radius_both_units_error - error when both km and mi specified - test_search_radius_negative_value - error on negative radius - test_search_radius_without_place - error when radius without place - test_search_place_exact_match - exact place matching ask.py CLI (60% → expected ~75%): - test_ask_interactive_mode - interactive Q&A mode - test_ask_interactive_exit_commands - exit/quit/q commands These tests cover error paths and edge cases for the search and ask commands.
Added 22 tests covering: - strip_source_type_prefix (6 tests) - format_citation_info for freeform and template citations (2 tests) - process_citations_in_text with various scenarios (5 tests) - generate_footnotes_section with first/subsequent logic (2 tests) - generate_sources_section with sorting and deduplication (3 tests) - format_sources_section for legacy formatting styles (4 tests) Coverage improved: citations.py 44% → 58% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added 26 tests covering: - format_tokens for display formatting (3 tests) - format_duration for time display (3 tests) - _format_image_caption with various year combinations (4 tests) - _format_image_path for media file handling (4 tests) - render_metadata with/without LLM metadata (3 tests) - render_markdown with all sections and options (9 tests) - Biography.calculate_word_count excluding footnotes/sources (1 test) Coverage improved: rendering.py 9% → 94% 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Removed pytest, datetime, UTC, and Path imports that were not used in test_citations.py and test_rendering.py. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Added --cov-report=xml to pytest command and specified coverage.xml file in codecov action to fix coverage upload failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <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.
Summary
This PR adds comprehensive tests for high and medium-impact components, achieving the target of 80%+ overall test coverage.
Added 61 new tests across 1,070 lines covering:
Test Coverage Improvements
queries.py (8 new tests)
search_names_flexible- flexible name searchsearch_names_by_words- multi-word searchsearch_names_with_married- maiden/married name searchsearch_names_with_married_by_words- multi-word married name searchfind_places_within_radius- geospatial search with distance sortingfind_places_within_radius_no_coordinates- error handling for missing GPSget_person_count_by_place- unique person countingfind_places_exact_match- exact place name matchingCLI Commands (13 new tests)
person.py (6 tests):
--events,--family,--ancestors,--descendantssearch.py (5 tests):
--married-namesearch--exactflagask.py (2 tests):
Biography Components (48 new tests)
citations.py (22 tests):
strip_source_type_prefix- clean up source names (6 tests)format_citation_info- freeform and template citations (2 tests)process_citations_in_text- {{cite:ID}} marker processing (5 tests)generate_footnotes_section- first/subsequent footnote logic (2 tests)generate_sources_section- bibliography with sorting/deduplication (3 tests)format_sources_section- legacy citation styles (4 tests)rendering.py (26 tests):
format_tokens- display formatting for LLM metadata (3 tests)format_duration- time display formatting (3 tests)_format_image_caption- caption generation with year variations (4 tests)_format_image_path- media file path handling (4 tests)render_metadata- Hugo front matter with/without LLM metadata (3 tests)render_markdown- complete biography rendering with all options (9 tests)Component Coverage Details
Test Strategy
Focused on high and medium-impact areas:
Lower priority items not included:
CI/CD Updates
This PR builds on previous improvements:
Expected CI Results
🤖 Generated with Claude Code