Skip to content

Commit 2e66052

Browse files
committed
Add test for warning
1 parent ff92257 commit 2e66052

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_functions.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"""
2727
import collections
2828
import json
29+
import logging
2930
import unittest
3031

3132
import msprime
@@ -457,9 +458,13 @@ def test_single_tree_ts_disallow_unary(self):
457458
with pytest.raises(ValueError, match="unary"):
458459
self.get_mixture_prior_params(ts, "gamma")
459460

460-
def test_single_tree_ts_with_unary(self):
461+
def test_single_tree_ts_with_unary(self, caplog):
461462
ts = utility_functions.single_tree_ts_with_unary()
462-
mixture_priors = self.get_mixture_prior_params(ts, "gamma", allow_unary=True)
463+
with caplog.at_level(logging.WARNING):
464+
mixture_priors = self.get_mixture_prior_params(
465+
ts, "gamma", allow_unary=True
466+
)
467+
assert "tsdate may give poor results" in caplog.text
463468
# Root is a 3 tip prior
464469
assert np.allclose(mixture_priors[7, self.alpha_beta], [1.6, 1.2])
465470
# Node 6 should be a 50:50 mixture between 1 and 3 tips

0 commit comments

Comments
 (0)