def test_map_coordinate_instance(self, example_map, input_list): """ A test to check if an instance of Island given initial coordinates return the true biome-letter. """ island = sim.BioSim(example_map, input_list, None) with pytest.raises(KeyError): coordinate = island.map[(0, 0)]
def test_different_length(self): with pytest.raises(ValueError): sim.BioSim("OOOO\nOMO\nOOO", None, None)
def test_invalid_landscape(self): with pytest.raises(ValueError): sim.BioSim("OOO\nORO\nOOO", None, None)
def test_value_error_raised_placement_mountain_ocean(self): test_map = 'OOOO\nOMDO\nOOO' input = [{'loc': (1, 1), 'pop': [{'species': 'Herbivore', 'age': 10, 'weight': 12.5}]}] with pytest.raises(ValueError): sim.BioSim(test_map, input, None)
def test_tot_w_herbivores(self, input_list, example_map): i = sim.BioSim(example_map, input_list, None) c = i.map[(1, 1)] assert c.tot_w_herbivores == 22.8
def test_place_animal(self, input_list, example_map): i = sim.BioSim(example_map, input_list, None) herbivore_list = i.map[(1, 1)] assert len(herbivore_list.population['Herbivore']) == 2