Skip to content

Commit

Permalink
make the rebuild fn local
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Nov 27, 2024
1 parent 96826a1 commit 4650ac2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/test_metadata_roundtrips_via_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import msprime
import pytest

import rebuild_pdict


@pytest.fixture
def pdict(request):
Expand Down Expand Up @@ -201,7 +199,16 @@ def test_metadata_roundtrip_single_deme_sim_with_parameters(rng, pdict, pop, inc
)

provenance = json.loads(ts.provenance(0).record)
params_dict = rebuild_pdict.rebuild_pdict(provenance)

def rebuild_pdict(provenance):
import fwdpy11

for i in dir(fwdpy11):
exec(f"from fwdpy11 import {i}")
params_dict = eval(provenance["parameters"]["params_dict"])
return params_dict

params_dict = rebuild_pdict(provenance)

assert params_dict == params.asdict()
script = provenance["parameters"]["script"]
Expand Down

0 comments on commit 4650ac2

Please sign in to comment.