Skip to content

Commit

Permalink
tests pass but seem odd to me
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Jul 17, 2024
1 parent a968328 commit c4c264e
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions tests/test_conditional_simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,30 +217,35 @@ def test_sweep_from_new_mutation_using_API(
assert output.num_descendant_nodes == 1
assert output.pop.generation > pop.generation
if output.pop is not None:
assert output.mutation_index is not None, f"{prune_selected}"
assert output.pop.mcounts[output.mutation_index] == 2 * output.pop.N
_ = output.pop.dump_tables_to_tskit()
if output.pop.fixation_times[output.mutation_index] < output.pop.generation:
for md in output.pop.ancient_sample_metadata:
for n in md.nodes:
assert (
output.pop.tables.nodes[n].time
== output.pop.fixation_times[output.mutation_index]
)
ti = fwdpy11.TreeIterator(
output.pop.tables,
output.pop.ancient_sample_nodes,
update_samples=True,
)
for t in ti:
for mutation in t.mutations():
assert mutation.key == output.mutation_index
assert t.leaf_counts(mutation.node) == 2 * pop.N
for s in t.samples_below(mutation.node):
if output.mutation_index is not None:
assert prune_selected is False
assert output.pop.mcounts[output.mutation_index] == 2 * output.pop.N
_ = output.pop.dump_tables_to_tskit()
if output.pop.fixation_times[output.mutation_index] < output.pop.generation:
for md in output.pop.ancient_sample_metadata:
for n in md.nodes:
assert (
output.pop.tables.nodes[s].time
output.pop.tables.nodes[n].time
== output.pop.fixation_times[output.mutation_index]
)
ti = fwdpy11.TreeIterator(
output.pop.tables,
output.pop.ancient_sample_nodes,
update_samples=True,
)
for t in ti:
for mutation in t.mutations():
assert mutation.key == output.mutation_index
assert t.leaf_counts(mutation.node) == 2 * pop.N
for s in t.samples_below(mutation.node):
assert (
output.pop.tables.nodes[s].time
== output.pop.fixation_times[output.mutation_index]
)
else:
assert prune_selected is True
# TODO: how can this not be true?
# assert len(pop.fixations) > 0, f"{prune_selected}"

ti = fwdpy11.TreeIterator(output.pop.tables, output.pop.alive_nodes)
for t in ti:
Expand Down

0 comments on commit c4c264e

Please sign in to comment.