From ca04e543e370b9b47ca3fff89d363c38c612e258 Mon Sep 17 00:00:00 2001 From: Gregor Gorjanc Date: Mon, 23 Dec 2024 07:43:56 +0000 Subject: [PATCH] Squash unintended rec rate test warnings #1626 --- tests/test_models.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/test_models.py b/tests/test_models.py index 24fa5df3c..4d15b4725 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -34,10 +34,19 @@ def test_debug_runs(self): @pytest.mark.filterwarnings("ignore:.*Zigzag_1S14.*:UserWarning") def test_simulation_runs(self): - # With a recombination_map of None, we simulate a coalescent without - # recombination in msprime, with mutation rate equal to rate from model. + # When model has no specific recombination rate, + # we simulate coalescent without recombination. + # Otherwise, we use the rate from the model. + # We use mutation rate equal to rate from model + # (or species when the model does not have one. + if self.model.recombination_rate is None: + recombination_rate = 0 + else: + recombination_rate = self.model.recombination_rate contig = stdpopsim.Contig.basic_contig( - length=100, mutation_rate=self.model.mutation_rate + length=100, + mutation_rate=self.model.mutation_rate, + recombination_rate=recombination_rate, ) # Generate vector with 2 samples for each pop with sampling enabled samples = {}