Skip to content

Commit

Permalink
Add another test triggering #844
Browse files Browse the repository at this point in the history
  • Loading branch information
molpopgen committed Nov 3, 2021
1 parent 019671e commit 636b8b4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_tree_sequences.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ def testQtraitSim(self):
MD = namedtuple("MD", ["g", "e", "w", "label"])

class Recorder(object):
""" Records entire pop every 100 generations """
"""Records entire pop every 100 generations"""

def __init__(self):
self.data = []
Expand Down Expand Up @@ -1526,5 +1526,19 @@ def test_table_indexing_during_sim(test_table_indexing_during_sim_recorder):
assert test_table_indexing_during_sim_recorder.called > 0


def test_only_preserve_final_generation():
"""
This test also triggers GitHub issue 844
"""
params, rng, pop = set_up_quant_trait_model(0.1)

def preserver(pop, sampler):
if pop.generation == preserver.when:
sampler.assign(np.arange(pop.N, dtype=np.uint32))

preserver.when = params.simlen
fwdpy11.evolvets(rng, pop, params, 100, recorder=preserver)


if __name__ == "__main__":
unittest.main()

0 comments on commit 636b8b4

Please sign in to comment.