Skip to content

Commit 55e2f47

Browse files
committed
add test for copies=0 in test_cnv_translator
1 parent f603b53 commit 55e2f47

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

tests/extras/test_cnv_translator.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,15 @@ def test_from_hgvs_cn(tlr, hgvsexpr, copies, expected):
161161
"""Test that _from_hgvs works correctly for copy number count"""
162162
cn = tlr._from_hgvs(hgvsexpr, copies=copies)
163163
assert cn.model_dump(exclude_none=True) == expected
164+
165+
166+
@pytest.mark.vcr
167+
def test_from_hgvs_cn_copies_zero(tlr):
168+
"""Test that copies=0 produces CopyNumberCount, not CopyNumberChange.
169+
170+
copies=0 is a valid input (homozygous deletion), but 0 is falsy in Python
171+
so it was previously treated as missing and fell through to CopyNumberChange.
172+
"""
173+
cn = tlr._from_hgvs("NC_000013.11:g.26440969_26443305del", copies=0)
174+
assert cn.type == "CopyNumberCount"
175+
assert cn.copies == 0

0 commit comments

Comments
 (0)