Skip to content

Commit a4a343e

Browse files
committed
test: Update test to expect UserWarning instead of ValueError for empty variant query results
The snp_frq.py code was updated to issue a UserWarning instead of raising ValueError when a variant_query returns no results, but the corresponding test was not updated. This fixes the test to use pytest.warns(UserWarning) and verify that the returned dataset has zero variants.
1 parent 0353643 commit a4a343e

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

tests/anoph/test_snp_frq.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,24 +1520,27 @@ def test_allele_frequencies_advanced_with_variant_query(
15201520
variant_query=variant_query,
15211521
)
15221522

1523-
# Test a query that should fail.
1523+
# Test a query that should warn and return empty.
15241524
variant_query = "effect == 'foobar'"
1525-
with pytest.raises(ValueError):
1526-
api.snp_allele_frequencies_advanced(
1525+
with pytest.warns(UserWarning):
1526+
ds_snp = api.snp_allele_frequencies_advanced(
15271527
transcript=transcript,
15281528
sample_sets=all_sample_sets,
15291529
area_by=area_by,
15301530
period_by=period_by,
15311531
variant_query=variant_query,
15321532
)
1533-
with pytest.raises(ValueError):
1534-
api.aa_allele_frequencies_advanced(
1533+
assert ds_snp.sizes["variants"] == 0
1534+
1535+
with pytest.warns(UserWarning):
1536+
ds_aa = api.aa_allele_frequencies_advanced(
15351537
transcript=transcript,
15361538
sample_sets=all_sample_sets,
15371539
area_by=area_by,
15381540
period_by=period_by,
15391541
variant_query=variant_query,
15401542
)
1543+
assert ds_aa.sizes["variants"] == 0
15411544

15421545

15431546
@pytest.mark.parametrize("nobs_mode", ["called", "fixed"])

0 commit comments

Comments
 (0)