Skip to content

test: add tests for to_hashable_items, variant_distance, and split_haplotypes#15

Open
ameynert wants to merge 1 commit intoam_13_enable_hail_testsfrom
am_14_test_haplotype
Open

test: add tests for to_hashable_items, variant_distance, and split_haplotypes#15
ameynert wants to merge 1 commit intoam_13_enable_hail_testsfrom
am_14_test_haplotype

Conversation

@ameynert
Copy link
Copy Markdown
Collaborator

Summary

Adds tests/test_haplotype.py covering the three functions in haplotype.py that don't require reference genome sequence data:

  • to_hashable_items: empty dict, single entry, sort-by-key order
  • variant_distance (requires hail_context): adjacent SNPs (distance 0), SNPs with a gap, deletion that closes the gap
  • split_haplotypes (requires hail_context): no split when all variants fit in one window; split at a gap exceeding the window; singleton segment discarded after a split

The variant_distance and split_haplotypes tests use the session-scoped hail_context fixture and a _make_haplotype_table helper that builds a minimal Hail table with a tstruct schema (position-only locus, alleles, haplotype, gnomad_freqs).

Test plan

  • pixi run check-all passes
  • All 9 tests in test_haplotype.py pass

🤖 Generated with Claude Code

…plotypes

Covers the three non-reference-data functions in haplotype.py:
- to_hashable_items: empty dict, single entry, sort order
- variant_distance: adjacent SNPs (distance 0), SNPs with gap,
  deletion that closes a gap
- split_haplotypes: no split needed, split at large gap, singleton
  segment discarded

The variant_distance and split_haplotypes tests require a Hail context
and request the session-scoped hail_context fixture from conftest.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 13, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 24e88dad-6142-45a3-8aa4-521b397a9d3f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch am_14_test_haplotype

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant