def test_eat(self): carnivore = Carnivore() carnivore.weight = 30 carnivore.eat(1000, 0) assert carnivore.weight == 30 + carnivore.F * carnivore.beta carnivore.weight = 30 carnivore.eat(10, 0) assert carnivore.weight == 30 + 10 * carnivore.beta carnivore.weight = 30 carnivore.eat(1000, 45) assert carnivore.weight == 30 + 5 * carnivore.beta
def test_weight(): """Tests that it is possible to set and get weight of an animal.""" herb = Herbivore(10, 20) carn = Carnivore(10, 20) assert herb.weight == 20 assert carn.weight == 20 herb.weight = 30 carn.weight = 30 assert herb.weight == 30 assert carn.weight == 30