def test_topo_remove_carnivore(): """Tests that an emigrating animal can be removed from its old cells animal list""" cell = topo.Topography() testcarni = animals.Carnivores() testlist = [animals.Carnivores() for _ in range(10)] cell.herbivore_list = testlist cell.add_animal(testcarni) cell.remove_animal(testcarni) assert testcarni not in cell.herbivore_list
def test_topo_add_carnivore(): """Tests that an immigrating animal can be added to the new cells animal list""" instance = topo.Topography() instance.add_animal(animals.Carnivores()) assert len(instance.carnivore_list) == 1
def test_topo_current_occupants_positive(): """Test that the numbers of herbivore and carnivores occupants in a cell is either 0 or positive""" instance = topo.Topography() assert instance.current_occupants()["Herbivores"] >= 0\ and instance.current_occupants()["Carnivores"] >= 0
def test_topo_current_fodder(): """Test that the amount of fodder is a float and greater than 0""" instance = topo.Topography() assert type(instance.current_fodder()) == float \ and instance.current_fodder() >= 0
def test_topo_current_occupants_int(): """Test that the numbers of herbivore and carnivores occupants in a cell is an int""" instance = topo.Topography() assert type(instance.current_occupants()["Herbivores"]) == int and type( instance.current_occupants()["Carnivores"]) == int