Skip to content

Commit 35d7b80

Browse files
Add test for custom per-source recombination/mismatch overrides
Covers the previously untested branches in Matcher._match_one() where MatchSourceConfig.recombination and .mismatch are not None.
1 parent 60fb9a3 commit 35d7b80

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_matching.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,19 @@ def test_mutations_have_valid_fields(self):
345345
assert isinstance(m.position, float)
346346
assert isinstance(m.derived_state, int)
347347

348+
def test_match_with_custom_recombination_and_mismatch(self):
349+
"""Custom per-source recombination/mismatch overrides are used."""
350+
hap = np.array([0, 1, 0], dtype=np.int8)
351+
ts = self._make_ts_with_one_ancestor(hap)
352+
source_params = {
353+
"test": config.MatchSourceConfig(recombination=0.5, mismatch=0.1),
354+
}
355+
matcher = matching.Matcher(ts, self.positions, source_parameters=source_params)
356+
results = list(matcher.match(_jobs(1), _ArrayReader([hap])))
357+
assert len(results) == 1
358+
_, r = results[0]
359+
assert len(r.path) > 0
360+
348361

349362
# ---------------------------------------------------------------------------
350363
# TestExtendTs

0 commit comments

Comments
 (0)