def test_run5(self): (gen_ct, initial_pop, final_pop, custom_data) = self.sim.run() assert (fastfuncs.pop_equals(final_pop, np.array((0., 1.)), self.sim.effective_zero) or\ fastfuncs.pop_equals(initial_pop, np.array((1., 0.)), self.sim.effective_zero)), "Final population was unexpected: {0} from {1} -> {2}".format(final_pop, initial_pop, self.sim._step_generation(initial_pop)) assert gen_ct >= 1 assert_equal(len(initial_pop), len(self.sim.types)) assert_equal(self.sim.result_data, "test") assert_equal(custom_data, "test")
def test_run6(self): (gen_ct, initial_pop, final_pop, custom_data) = self.sim.run() assert not ( fastfuncs.pop_equals(final_pop, np.array((0.0, 1.0)), self.sim.effective_zero) or fastfuncs.pop_equals(initial_pop, np.array((1.0, 0.0)), self.sim.effective_zero) ), "Final population was unexpected: {0} from {1} -> {2}".format( final_pop, initial_pop, self.sim._step_generation(initial_pop) ) assert_equal(gen_ct, 1) assert_equal(len(initial_pop), len(self.sim.types)) assert_equal(self.sim.result_data, "test2") assert_equal(custom_data, "test2") assert_equal(self.sim.force_stop, True)
def test_run(self): (gen_ct, initial_pop, final_pop, custom_data) = self.sim.run() assert fastfuncs.pop_equals(final_pop, np.array(((0., 1.), (0., 1.))), self.sim.effective_zero), "Final population was instead {0}".format(final_pop) assert gen_ct >= 1 assert_equal(len(initial_pop), len(self.sim.types)) assert_equal(self.sim.result_data, "test") assert_equal(custom_data, "test")
def test_run2(self): (gen_ct, initial_pop, final_pop, custom_data) = self.sim.run() assert fastfuncs.pop_equals( final_pop, np.array((0.0, 1.0)), self.sim.effective_zero ), "Final population was unexpected: {0} from {1} -> {2}".format( final_pop, initial_pop, self.sim._step_generation(initial_pop) ) assert gen_ct >= 1 assert_equal(len(initial_pop), len(self.sim.types))
def test_run4(self): self.sim.is_running = True self.sim.emit("run", self.sim) (gen_ct, initial_pop, final_pop, custom_data) = self.sim._run( np.array((1.0 - 2.0 * self.sim.effective_zero, 2.0 * self.sim.effective_zero), dtype=np.float64) ) self.sim.emit("done", self.sim) assert fastfuncs.pop_equals( final_pop, np.array((0.0, 1.0)), self.sim.effective_zero ), "Final population was unexpected: {0}".format(final_pop) assert gen_ct >= 1 assert_equal(len(initial_pop), len(self.sim.types))
def test_run4(self): self.sim.is_running = True self.sim.emit('run', self.sim) (gen_ct, initial_pop, final_pop, custom_data) = self.sim._run( np.array((1. - 2. * self.sim.effective_zero, 2. * self.sim.effective_zero), dtype=np.float64)) self.sim.emit('done', self.sim) assert fastfuncs.pop_equals( final_pop, np.array((0., 1.)), self.sim.effective_zero ), "Final population was unexpected: {0}".format(final_pop) assert gen_ct >= 1 assert_equal(len(initial_pop), len(self.sim.types))
def test_pop_equals(self): # try: assert fastfuncs.pop_equals( np.array((1.0, 0.0)), np.array((1.0, self.sim.effective_zero / 10.0)), self.sim.effective_zero )
def test_pop_equals(self): #try: assert fastfuncs.pop_equals( np.array((1., 0.)), np.array((1., self.sim.effective_zero / 10.)), self.sim.effective_zero)
def test_run(self): (gen_ct, initial_pop, final_pop, custom_data) = self.sim.run() assert not fastfuncs.pop_equals(final_pop, np.array(((0., 1., 0.), (0., 1., 0.), (0., 0., 1.))), self.sim.effective_zero), "Final population was {0}".format(final_pop) assert gen_ct > 1 assert_equal(len(initial_pop), len(self.sim.types)) assert_equal(self.sim.force_stop, False)
def test_pop_equals(self): #try: assert fastfuncs.pop_equals assert fastfuncs.pop_equals(np.array(((1., 0.), (1., 0.)), dtype=np.float64), np.array(((1., self.sim.effective_zero / 10.), (1., self.sim.effective_zero / 10.)), dtype=np.float64), self.sim.effective_zero)