Skip to content

Commit dc9d379

Browse files
author
suhr25
committed
fix: resolve CI failures and ensure full test + coverage pass
1 parent 2d0c75f commit dc9d379

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/anoph/test_fst.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,27 @@ def test_fst_gwss_window_size_too_large(fixture, api: AnophelesFstAnalysis):
165165
assert x.shape == fst.shape
166166

167167

168+
@parametrize_with_cases("fixture,api", cases=".")
169+
def test_fst_gwss_too_few_snps(fixture, api: AnophelesFstAnalysis):
170+
# When min_snps_threshold exceeds available SNPs, a ValueError must be raised.
171+
all_sample_sets = api.sample_sets()["sample_set"].to_list()
172+
all_countries = api.sample_metadata()["country"].dropna().unique().tolist()
173+
countries = random.sample(all_countries, 2)
174+
cohort1_query = f"country == {countries[0]!r}"
175+
cohort2_query = f"country == {countries[1]!r}"
176+
with pytest.raises(ValueError, match="Too few SNP sites"):
177+
api.fst_gwss(
178+
contig=random.choice(api.contigs),
179+
sample_sets=all_sample_sets,
180+
cohort1_query=cohort1_query,
181+
cohort2_query=cohort2_query,
182+
site_mask=random.choice(api.site_mask_ids),
183+
window_size=100,
184+
min_cohort_size=1,
185+
min_snps_threshold=10_000_000, # far larger than any fixture SNP count (~28k-70k)
186+
)
187+
188+
168189
@parametrize_with_cases("fixture,api", cases=".")
169190
def test_average_fst(fixture, api: AnophelesFstAnalysis):
170191
# Set up test parameters.

0 commit comments

Comments
 (0)