Ejemplo n.º 1
0
    def test(self):
        animal = Animal()

        species = Species()
        species.minimum_breeding_age = 1

        simulation_step = SimulationStep()
        simulation_step.month = MONTHS_IN_YEAR

        self.assertTrue(can_breed(animal, species, simulation_step))
Ejemplo n.º 2
0
    def test_too_young(self):
        animal = Animal()

        species = Species()
        species.minimum_breeding_age = 1

        simulation_step = SimulationStep()
        simulation_step.month = 0

        self.assertFalse(can_breed(animal, species, simulation_step))
Ejemplo n.º 3
0
def species_from_config(config):
    attributes = config['attributes']

    species = Species()
    species.name = config['name']
    species.life_span = attributes['life_span']
    species.monthly_food_consumption = attributes['monthly_food_consumption']
    species.monthly_water_consumption = attributes['monthly_water_consumption']
    species.minimum_temperature = attributes['minimum_temperature']
    species.maximum_temperature = attributes['maximum_temperature']
    species.gestation_months = attributes['gestation_period']
    species.minimum_breeding_age = attributes['minimum_breeding_age']

    return species