def test_dict_converted_correctly_to_list_and_array( self, example_properties, example_population): """ Asserts that the output from convert_dict_to_list_and_array method are of the correct types. """ herbivore = Herbivore(example_properties) dict_of_neighbours = { (1, 2): Jungle(example_population), (2, 1): Jungle(example_population), (2, 3): Jungle(example_population), (3, 2): Jungle(example_population) } for jungle in dict_of_neighbours.values(): jungle.regrowth() prob_dict = herbivore.prob_move_to_each_neighbour(dict_of_neighbours) locs, probs = herbivore.convert_dict_to_list_and_array(prob_dict) assert type(locs) is list assert type(probs) is numpy.ndarray
def test_correct_types_in_prob_move_dict(self, example_population, example_properties): """ Asserts that the prob_move_to_each_neighbour method returns a dictionary with tuples as keys and floats as values. """ herbivore = Herbivore(example_properties) dict_of_neighbours = { (1, 2): Jungle(example_population), (2, 1): Jungle(example_population), (2, 3): Jungle(example_population), (3, 2): Jungle(example_population) } for jungle in dict_of_neighbours.values(): jungle.regrowth() prob_dict = herbivore.prob_move_to_each_neighbour(dict_of_neighbours) assert type(prob_dict) is dict for loc, prob in prob_dict.items(): assert type(loc) is tuple assert type(prob) is float