def get_initial_simulation_step(): male = Animal() male.gender = GENDER_MALE female = Animal() female.gender = GENDER_FEMALE simulation_step = SimulationStep() simulation_step.animals.append(male) simulation_step.animals.append(female) return simulation_step
def get_new_animals_from_breeding(count, month): for female in range(count): gender = get_new_animal_gender() born_animal = Animal() born_animal.birth_month = month born_animal.last_feed_month = month - 1 born_animal.gender = gender yield born_animal
def test_finish_breeding(self): simulation_step = SimulationStep() animal = Animal() animal.gender = GENDER_FEMALE animal.gestation_months = 1 species = Species() species.gestation_months = 1 new_animals = tuple(breed_animals([animal], species, simulation_step)) self.assertEqual(0, animal.gestation_months) self.assertEqual(1, len(new_animals))