Skip to content

Commit 4e5736f

Browse files
committed
add msprime and use np.testing
1 parent b98b5c1 commit 4e5736f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

requirements-dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ pytest-datadir
66
hypothesis
77
statsmodels
88
zarr
9+
msprime
910
sphinx
1011
sphinx_rtd_theme

sgkit/tests/test_popgen.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_diversity(size):
3939
ds = ts_to_dataset(ts) # type: ignore[no-untyped-call]
4040
div = diversity(ds).compute()
4141
ts_div = ts.diversity(span_normalise=False)
42-
assert np.allclose(div, ts_div)
42+
np.testing.assert_allclose(div, ts_div)
4343

4444

4545
@pytest.mark.parametrize("size", [2, 3, 10, 100])
@@ -51,7 +51,7 @@ def test_divergence(size):
5151
ds2 = ts_to_dataset(ts, subset_2) # type: ignore[no-untyped-call]
5252
div = divergence(ds1, ds2).compute()
5353
ts_div = ts.divergence([subset_1, subset_2], span_normalise=False)
54-
assert np.allclose(div, ts_div)
54+
np.testing.assert_allclose(div, ts_div)
5555

5656

5757
@pytest.mark.parametrize("size", [2, 3, 10, 100])
@@ -63,7 +63,7 @@ def test_Fst(size):
6363
ds2 = ts_to_dataset(ts, subset_2) # type: ignore[no-untyped-call]
6464
fst = Fst(ds1, ds2).compute()
6565
ts_fst = ts.Fst([subset_1, subset_2])
66-
assert np.allclose(fst, ts_fst)
66+
np.testing.assert_allclose(fst, ts_fst)
6767

6868

6969
@pytest.mark.parametrize("size", [2, 3, 10, 100])
@@ -72,4 +72,4 @@ def test_Tajimas_D(size):
7272
ds = ts_to_dataset(ts) # type: ignore[no-untyped-call]
7373
ts_d = ts.Tajimas_D()
7474
d = Tajimas_D(ds).compute()
75-
assert np.allclose(d, ts_d)
75+
np.testing.assert_allclose(d, ts_d)

0 commit comments

Comments
 (0)