@@ -103,15 +103,27 @@ def test_no_provenance_match_samples(self, small_sd_fixture):
103
103
assert ts .num_provenances == small_sd_fixture .num_provenances
104
104
105
105
@pytest .mark .parametrize ("mmr" , [None , 0.1 ])
106
- def test_provenance_infer (self , small_sd_fixture , mmr ):
106
+ @pytest .mark .parametrize ("pc" , [True , False ])
107
+ @pytest .mark .parametrize ("post" , [True , False ])
108
+ @pytest .mark .parametrize ("precision" , [4 , 5 ])
109
+ def test_provenance_infer (self , small_sd_fixture , mmr , pc , post , precision ):
107
110
ts = tsinfer .infer (
108
- small_sd_fixture , mismatch_ratio = mmr , recombination_rate = 1e-8
111
+ small_sd_fixture ,
112
+ path_compression = pc ,
113
+ post_process = post ,
114
+ precision = precision ,
115
+ mismatch_ratio = mmr ,
116
+ recombination_rate = 1e-8 ,
109
117
)
110
118
assert ts .num_provenances == small_sd_fixture .num_provenances + 1
111
119
record = json .loads (ts .provenance (- 1 ).record )
112
120
params = record ["parameters" ]
113
121
assert params ["command" ] == "infer"
122
+ assert params ["post_process" ] == post
123
+ assert params ["precision" ] == precision
114
124
assert params ["mismatch_ratio" ] == mmr
125
+ assert params ["path_compression" ] == pc
126
+ assert "simplify" not in params
115
127
116
128
def test_provenance_generate_ancestors (self , small_sd_fixture ):
117
129
ancestors = tsinfer .generate_ancestors (small_sd_fixture )
@@ -122,24 +134,42 @@ def test_provenance_generate_ancestors(self, small_sd_fixture):
122
134
assert params ["command" ] == "generate_ancestors"
123
135
124
136
@pytest .mark .parametrize ("mmr" , [None , 0.1 ])
125
- def test_provenance_match_ancestors (self , small_sd_fixture , mmr ):
137
+ @pytest .mark .parametrize ("pc" , [True , False ])
138
+ @pytest .mark .parametrize ("precision" , [4 , 5 ])
139
+ def test_provenance_match_ancestors (self , small_sd_fixture , mmr , pc , precision ):
126
140
ancestors = tsinfer .generate_ancestors (small_sd_fixture )
127
141
anc_ts = tsinfer .match_ancestors (
128
- small_sd_fixture , ancestors , mismatch_ratio = mmr , recombination_rate = 1e-8
142
+ small_sd_fixture ,
143
+ ancestors ,
144
+ mismatch_ratio = mmr ,
145
+ recombination_rate = 1e-8 ,
146
+ path_compression = pc ,
147
+ precision = precision ,
129
148
)
130
149
assert anc_ts .num_provenances == small_sd_fixture .num_provenances + 2
131
150
params = json .loads (anc_ts .provenance (- 2 ).record )["parameters" ]
132
151
assert params ["command" ] == "generate_ancestors"
133
152
params = json .loads (anc_ts .provenance (- 1 ).record )["parameters" ]
134
153
assert params ["command" ] == "match_ancestors"
135
154
assert params ["mismatch_ratio" ] == mmr
155
+ assert params ["path_compression" ] == pc
156
+ assert params ["precision" ] == precision
136
157
137
158
@pytest .mark .parametrize ("mmr" , [None , 0.1 ])
138
- def test_provenance_match_samples (self , small_sd_fixture , mmr ):
159
+ @pytest .mark .parametrize ("pc" , [True , False ])
160
+ @pytest .mark .parametrize ("post" , [True , False ])
161
+ @pytest .mark .parametrize ("precision" , [4 , 5 ])
162
+ def test_provenance_match_samples (self , small_sd_fixture , mmr , pc , precision , post ):
139
163
ancestors = tsinfer .generate_ancestors (small_sd_fixture )
140
164
anc_ts = tsinfer .match_ancestors (small_sd_fixture , ancestors )
141
165
ts = tsinfer .match_samples (
142
- small_sd_fixture , anc_ts , mismatch_ratio = mmr , recombination_rate = 1e-8
166
+ small_sd_fixture ,
167
+ anc_ts ,
168
+ mismatch_ratio = mmr ,
169
+ path_compression = pc ,
170
+ precision = precision ,
171
+ post_process = post ,
172
+ recombination_rate = 1e-8 ,
143
173
)
144
174
assert ts .num_provenances == small_sd_fixture .num_provenances + 3
145
175
params = json .loads (ts .provenance (- 3 ).record )["parameters" ]
@@ -149,6 +179,23 @@ def test_provenance_match_samples(self, small_sd_fixture, mmr):
149
179
params = json .loads (ts .provenance (- 1 ).record )["parameters" ]
150
180
assert params ["command" ] == "match_samples"
151
181
assert params ["mismatch_ratio" ] == mmr
182
+ assert params ["path_compression" ] == pc
183
+ assert params ["precision" ] == precision
184
+ assert params ["post_process" ] == post
185
+ assert "simplify" not in params # deprecated
186
+
187
+ @pytest .mark .parametrize ("simp" , [True , False ])
188
+ def test_deprecated_simplify (self , small_sd_fixture , simp ):
189
+ # Included for completeness, but this is deprecated
190
+ ancestors = tsinfer .generate_ancestors (small_sd_fixture )
191
+ anc_ts = tsinfer .match_ancestors (small_sd_fixture , ancestors )
192
+ ts1 = tsinfer .match_samples (small_sd_fixture , anc_ts , simplify = simp )
193
+ ts2 = tsinfer .infer (small_sd_fixture , simplify = simp )
194
+ for ts in [ts1 , ts2 ]:
195
+ record = json .loads (ts .provenance (- 1 ).record )
196
+ params = record ["parameters" ]
197
+ assert params ["simplify" ] == simp
198
+ assert "post_process" not in params
152
199
153
200
154
201
class TestGetProvenance :
0 commit comments