Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis pull request adds comprehensive unit tests for the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
divref/tests/tools/test_remap_divref.py (1)
191-217: Add one explicit error-path test for parsing/contig edge inputs.This block has strong happy-path coverage, but it should also lock behavior for malformed or empty variant strings (e.g., invalid delimiter count), especially since
contig()depends on parsed output indexing.🧪 Suggested test additions
+import pytest + +def test_parsed_variants_malformed_variant_raises() -> None: + hap = create_haplotype(variants="chr1:100:A", n_variants=1) + with pytest.raises(ValueError): + hap.parsed_variants() + + +def test_contig_with_malformed_variant_raises() -> None: + hap = create_haplotype(variants="chr1:100:A", n_variants=1) + with pytest.raises(ValueError): + hap.contig()As per coding guidelines, "
**/*.py: New public functions require at least one happy-path test + one error case; bug fixes should include regression test".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@divref/tests/tools/test_remap_divref.py` around lines 191 - 217, Add a failing-input unit test that verifies parsing and contig() handle malformed or empty variant strings: use create_haplotype with variants="" and with a malformed entry like "chr1:100:A" (wrong delimiter count) and assert parsed_variants() raises the expected exception or returns an empty list (match project behavior), and that contig() either raises the same error or returns None/empty string accordingly; reference the parsed_variants() and contig() methods to locate the parsing logic and ensure the test asserts the explicit error-path contract expected by the codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@divref/tests/tools/test_remap_divref.py`:
- Around line 191-217: Add a failing-input unit test that verifies parsing and
contig() handle malformed or empty variant strings: use create_haplotype with
variants="" and with a malformed entry like "chr1:100:A" (wrong delimiter count)
and assert parsed_variants() raises the expected exception or returns an empty
list (match project behavior), and that contig() either raises the same error or
returns None/empty string accordingly; reference the parsed_variants() and
contig() methods to locate the parsing logic and ensure the test asserts the
explicit error-path contract expected by the codebase.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d97de64f-d5ec-4df6-b55f-f88044aff736
📒 Files selected for processing (1)
divref/tests/tools/test_remap_divref.py
57fd3ea to
a58f1dc
Compare
0a3aef2 to
ff42a60
Compare
a58f1dc to
3294ba9
Compare
…arse_pop_freqs Extends test_remap_divref.py with direct tests for the model methods and private helper that were previously only exercised indirectly via reference_mapping(): - Variant.render(): SNP, insertion, deletion - Haplotype.parsed_variants(): single variant, multiple variants, caching (second call returns same list object) - Haplotype.contig(): returns chromosome of first variant - ReferenceMapping.variants_involved_str(): empty, single, multiple - _parse_pop_freqs(): all floats, mixed nulls, single null Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Add three tests covering ValueError propagation when parsed_variants() receives an empty string or a variant token with fewer than 4 colon- delimited fields, and that contig() surfaces the same error. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
ff42a60 to
32993fe
Compare
Extends test_remap_divref.py with direct tests for the model methods and private helper that were previously only exercised indirectly via reference_mapping():
Summary by CodeRabbit
Tests