Skip to content

Commit ce01c2b

Browse files
committed
Added empty region tests for read_variant_stats() and read_allele_count()
These tests ensure that both methods return an empty DataFrame when the regions are empty or don't match the constraints of the query.
1 parent fb2a5b1 commit ce01c2b

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

apis/python/tests/test_tiledbvcf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,9 @@ def test_ingest_with_stats_v3(
13441344
with pytest.raises(Exception, match=interval_error):
13451345
test_stats_v3_ingestion.read_variant_stats_arrow(regions=["chr1:100-1"])
13461346

1347+
# test empty region
1348+
assert test_stats_v3_ingestion.read_variant_stats(regions=["chr3:1-10000"]).empty
1349+
13471350
# test types and deprecated region parameter
13481351
region1 = "chr1:1-10000"
13491352
df = test_stats_v3_ingestion.read_variant_stats(region1)
@@ -1551,7 +1554,8 @@ def test_ingest_with_stats_v3(
15511554
with pytest.raises(Exception, match=interval_error):
15521555
test_stats_v3_ingestion.read_allele_count_arrow(regions=["chr1:100-1"])
15531556

1554-
# test allele count
1557+
# test empty region
1558+
assert test_stats_v3_ingestion.read_allele_count(regions=["chr3:1-10000"]).empty
15551559

15561560
# test types and deprecated region parameter
15571561
region1 = "chr1:1-10000"
@@ -2458,6 +2462,7 @@ def test_delete_dataset(tmp_path):
24582462
# Check that the dataset does not exist
24592463
assert not os.path.exists(uri)
24602464

2465+
24612466
def test_equality_old_new_format():
24622467
old_ds = tiledbvcf.Dataset(os.path.join(TESTS_INPUT_DIR, "arrays/old_format"))
24632468
new_ds = tiledbvcf.Dataset(os.path.join(TESTS_INPUT_DIR, "arrays/new_format"))

0 commit comments

Comments
 (0)