Skip to content

Commit af1a103

Browse files
fix: correct off-by-one in virtual contigs region size assertion
The region string format is inclusive on both ends (start and stop), so region_size should be stop - start + 1, not stop - start. This caused a flaky assertion failure: assert 146 <= np.int64(145)
1 parent 4165560 commit af1a103

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/anoph/test_snp_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def test_snp_sites_with_virtual_contigs(ag3_sim_api, chrom):
314314
check_snp_sites(api, region=region)
315315

316316
# Extra checks.
317-
region_size = stop - start
317+
region_size = stop - start + 1
318318
pos = api.snp_sites(region=region, field="POS").compute()
319319
assert pos.shape[0] <= region_size
320320
assert np.all(pos >= start)

0 commit comments

Comments
 (0)