File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -127,8 +127,16 @@ def verify_demographic_events_equal(
127
127
to the specified tolerances and raises a UnequalModelsError otherwise.
128
128
"""
129
129
# Get the low-level dictionary representations of the events.
130
- dicts1 = [event .get_ll_representation (num_populations ) for event in events1 ]
131
- dicts2 = [event .get_ll_representation (num_populations ) for event in events2 ]
130
+ # XXX: Msprime introduced a breaking change between 0.7.4 and 1.0, removing
131
+ # the num_populations parameter to get_ll_representation(). See #518.
132
+ # When we depend on msprime 1.0, this should be changed to instead use
133
+ # msprime.DemographicEvent.asdict().
134
+ from inspect import signature
135
+ ll_args = ()
136
+ if len (signature (msprime .MassMigration .get_ll_representation ).parameters ) == 2 :
137
+ ll_args = (num_populations , )
138
+ dicts1 = [event .get_ll_representation (* ll_args ) for event in events1 ]
139
+ dicts2 = [event .get_ll_representation (* ll_args ) for event in events2 ]
132
140
if len (dicts1 ) != len (dicts2 ):
133
141
raise UnequalModelsError ("Different numbers of demographic events" )
134
142
for d1 , d2 in zip (dicts1 , dicts2 ):
Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ def test_different_types(self):
222
222
msprime .PopulationParametersChange (time = 1 , initial_size = 1 ),
223
223
msprime .MigrationRateChange (time = 1 , rate = 1 ),
224
224
msprime .MassMigration (time = 1 , source = 1 ),
225
- msprime .SimpleBottleneck (time = 1 )]
225
+ msprime .SimpleBottleneck (time = 1 , population = 0 )]
226
226
for a , b in itertools .combinations (events , 2 ):
227
227
self .assertFalse (models .demographic_events_equal ([a ], [b ], 1 ))
228
228
self .assertFalse (models .demographic_events_equal ([b ], [a ], 1 ))
You can’t perform that action at this time.
0 commit comments