Skip to content

Test coverage for reader.py and selection.py (0% → 79% / 100%) - #10

Merged
johnzfitch merged 2 commits into
masterfrom
claude/test-coverage-legacy
Jun 6, 2026
Merged

Test coverage for reader.py and selection.py (0% → 79% / 100%)#10
johnzfitch merged 2 commits into
masterfrom
claude/test-coverage-legacy

Conversation

@johnzfitch

Copy link
Copy Markdown
Owner

Fixes the two 0%-coverage modules surfaced when coverage reporting was wired up. Test-only — no source changes, branched off master so it's independent of the governance PRs (#6/#9).

What's covered

  • tests/test_selection.pyselection.py 0% → 100%. Drives the interactive CaseSelector + interactive_case_select/interactive_multi_select by swapping Prompt.ask for a queue of canned answers: pagination math, single-select (valid/out-of-range/non-numeric/next/prev/quit), multi-select (comma list, ranges, quit, bad format), the action menu, and the back/quit loops.
  • tests/test_reader.pyreader.py 0% → 79%. Covers DocketParser (fast parse/parse_file, the bs4 parse_data, the metadata extractors with crafted HTML — new-dict + legacy-tuple detailed_info, lawyer/party tables — and parse_dir) and DocketProcessor (text/docket/dir search + the CSV match writers), plus the if not HAS_BS4 fallback branches (which run when bs4 is absent).

58 new tests; full suite 218 passed, 6 skipped (the skips are the no-bs4 fallback tests, which only run when the [full] extra isn't installed). pyflakes clean.

Notes

https://claude.ai/code/session_01NNvhsYRVWhjfcdgaSmU5bt


Generated by Claude Code

These two modules had no test coverage. Add unit tests with no network:
- test_selection.py: drives the interactive CaseSelector/wrappers via a fake
  Prompt.ask queue (pagination, single/multi/range selection, actions, the
  back/quit loops) -> selection.py 100%.
- test_reader.py: DocketParser (fast parse, bs4 parse_data, the metadata
  extractors with crafted HTML, parse_dir) and DocketProcessor (text/docket/dir
  search + match writers), plus the no-bs4 fallback branches -> reader.py 79%.

No source changes. The DocumentSorter stub is deliberately not tested (it is
dead code removed in the governance PR), so these tests are compatible with both
master and that branch. 58 new tests; full suite 218 passed, 6 skipped.
Copilot AI review requested due to automatic review settings June 4, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds comprehensive pytest coverage for two previously uncovered interactive/data-processing modules (selection.py and reader.py), without modifying runtime source code. This improves confidence in CLI/TUI selection flows and docket parsing/search behavior as coverage reporting is introduced.

Changes:

  • Add deterministic tests for CaseSelector / interactive_case_select / interactive_multi_select by monkeypatching Prompt.ask with a FIFO answer queue.
  • Add broad tests for DocketParser and DocketProcessor, including parsing, directory processing, searching, and CSV output writers (with bs4-dependent portions gated by importorskip / HAS_BS4).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/test_selection.py Adds tests driving the Rich prompt-based selection logic via monkeypatched prompt responses.
tests/test_reader.py Adds tests for docket parsing, metadata extraction, searching, and CSV writing behaviors in reader.py.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_reader.py
Comment on lines +79 to +81
# ---------------------------------------------------------------------------
# bs4-fallback branches (these run *because* bs4 is absent in this env)
# ---------------------------------------------------------------------------
Comment thread tests/test_reader.py Outdated
Comment on lines +84 to +85
class TestDocketParserNoBs4Fallbacks:
"""Cover the `if not HAS_BS4` early-return branches."""
…iew)

The section header / class docstring implied the HAS_BS4-fallback tests run in
this environment; under CI's .[dev,full] install bs4 is present so they skip.
Reword to describe the condition (bs4 absent) per Copilot review.
@johnzfitch
johnzfitch merged commit f9bab69 into master Jun 6, 2026
@johnzfitch
johnzfitch deleted the claude/test-coverage-legacy branch June 6, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants