Skip to content

Commit 09d189b

Browse files
authored
Merge pull request #253 from hyanwong/tidying
Tidy tests and unpin numba
2 parents 72cb883 + eb28daf commit 09d189b

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tskit>=0.4.0
1+
tskit>=0.5.0
22
tsinfer>=0.3.0
33
flake8
44
numpy
@@ -7,7 +7,7 @@ daiquiri
77
msprime>=1.0.0
88
scipy
99
codecov
10-
numba==0.53.1
10+
numba
1111
appdirs
1212
pre-commit
1313
pytest

tests/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def compare_python_api(self, input_ts, cmd, Ne, mutation_rate, method):
218218
dated_ts = tsdate.date(
219219
input_ts, population_size=Ne, mutation_rate=mutation_rate, method=method
220220
)
221-
print(dated_ts.tables.nodes.time, output_ts.tables.nodes.time)
221+
# print(dated_ts.tables.nodes.time, output_ts.tables.nodes.time)
222222
assert np.array_equal(dated_ts.tables.nodes.time, output_ts.tables.nodes.time)
223223

224224
def test_ts(self):
@@ -284,7 +284,7 @@ def preprocess_compare_python_api(self, input_ts):
284284
input_ts.dump(input_filename)
285285
output_filename = pathlib.Path(tmpdir) / "output.trees"
286286
full_cmd = "preprocess " + str(input_filename) + f" {output_filename}"
287-
print(full_cmd)
287+
# print(full_cmd)
288288
cli.tsdate_main(full_cmd.split())
289289
output_ts = tskit.load(output_filename)
290290
preprocessed_ts = tsdate.preprocess_ts(input_ts)

tests/test_functions.py

Lines changed: 9 additions & 4 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
@@ -1093,8 +1098,8 @@ def test_two_tree_mutation_ts(self):
10931098

10941099
def test_dangling_fails(self):
10951100
ts = utility_functions.single_tree_ts_n2_dangling()
1096-
print(ts.draw_text())
1097-
print("Samples:", ts.samples())
1101+
# print(ts.draw_text())
1102+
# print("Samples:", ts.samples())
10981103
Ne = 0.5
10991104
with pytest.raises(ValueError, match="simplified"):
11001105
tsdate.build_prior_grid(ts, Ne, timepoints=np.array([0, 1.2, 2]))

0 commit comments

Comments
 (0)