def test_check_person_collided_with_target_true(self): """Bar and Person are collided, target destination""" new_bar = Bar([450, 450], "Bar 2", 30, 20) new_person = person.Person("person 2", [450, 450], 10, 0, 0) new_person.rememberedObj = new_bar result = new_person.check_person_collided_with_target(new_bar) self.assertTrue(result)
def test_object_in_vision_true(self): """Bar is not in vision and therefore True. qualifier adds the bar to the vision.""" new_bar = Bar([0, 0], "Bar 2", 100, 50) qualifier = self.testPerson.add_to_vision(new_bar) result = self.testPerson.object_in_vision(new_bar) self.assertTrue(result)
def test_check_obj_already_known_true(self): """Need an object and its type""" new_bar = Bar([0, 0], "Bar 2", 100, 50) """Adding the memory to the bar using the add_to_bar function""" self.testPerson.add_to_memory(new_bar) """True as the bar is added and object is already known""" result = self.testPerson.check_obj_already_known(new_bar, "Bar") self.assertTrue(result)
def test_action_dance(self): test_dancefloor = DanceFloor([50, 50], 100, 100, 100) self.test_person.inside_dance_floor = True self.test_person.rememberedObj = test_dancefloor self.test_person.stateMachine.set_current_state("dance") self.test_bar = Bar([110, 110], 30, 30, 30) self.test_map.mapData.append(self.test_bar) self.test_person.map = self.test_map self.test_person.action()
def test_action(self): self.test_person_3 = person.Person("person 2", [115, 115], 10, 0, 0) self.test_bar = Bar([120, 120], 30, 30, 30) self.test_map.mapData.append(self.test_person_3) self.test_map.mapData.append(self.test_bar) self.test_map.set_size_screen(500, 500) self.test_map.generate_nodes() self.test_person.map = self.test_map self.test_person.action()
def setUp(self): """Creating a map""" self.test_map = map_data.map_data(Mock(), 0) self.test_person = person.Person("person 1", [100, 100], 10, 0, 0) self.test_person_2 = person.Person("person 2", [200, 200], 10, 0, 0) self.test_dancefloor = DanceFloor([300, 300], 30, 30, 30) self.test_bar = Bar([400, 400], 30, 30, 30) self.test_toilet = Toilet([200, 200], "toilet", 200, 100) self.test_map.mapData.append(self.test_person) self.test_map.mapData.append(self.test_person_2) self.test_map.mapData.append(self.test_dancefloor)
def test_check_person_collided_with_target_false(self): """Person and Bar and nowhere near""" new_bar = Bar([450, 450], "Bar 2", 30, 20) result = self.testPerson.check_person_collided_with_target(new_bar) self.assertFalse(result)
def test_check_obj_already_known_false(self): """Need an object and its type""" new_bar = Bar([0, 0], "Bar 2", 100, 50) result = self.testPerson.check_obj_already_known(new_bar, "Bar") self.assertFalse(result)
def test_add_to_memory_alread_known_object(self): """Should return none, as bar has already been added to memory""" new_bar = Bar([0, 0], "Bar 2", 100, 50) self.testPerson.add_to_memory(new_bar) result2 = self.testPerson.add_to_memory(new_bar) self.assertEqual(result2, None)
def test_add_to_memory_true(self): """Instance of a bar, dancefloor or toilet""" new_bar = Bar([0, 0], "Bar 2", 100, 50) result = self.testPerson.add_to_memory(new_bar) self.assertTrue(result)
def test_object_in_vision_false(self): """Bar is not in vision and therefore false.""" new_bar = Bar([450, 450], "Bar 2", 30, 20) result = self.testPerson.object_in_vision(new_bar) self.assertFalse(result)
def setUp(self): self.testPerson = person.Person("person 1", [100, 100], 10, 0, 0) self.testPerson2 = person.Person("person 2", [20, 30], 10, 0, 0) self.test_bar = Bar([450, 450], "Bar", 30, 20) self.testPerson2.add_to_memory(self.test_bar)
def test_action_again(self): self.test_bar = Bar([110, 110], 30, 30, 30) self.test_map.mapData.append(self.test_bar) self.test_person.map = self.test_map self.test_person.action()
def test_count_objects_in_vision(self): include = False test_bar = Bar([120, 120], 30, 30, 30) self.test_person.add_to_vision(test_bar) self.assertEqual(self.test_person.count_objects_in_vision(include), 1) return
def test_count_objects_in_vision_include_people(self): include = True test_bar = Bar([120, 120], 30, 30, 30) self.test_person.add_to_vision(test_bar) self.assertTrue(self.test_person.count_objects_in_vision(include)) return
def test_flock(self): self.test_person_3 = person.Person("person 2", [115, 115], 10, 0, 0) self.test_bar = Bar([110, 110], 30, 30, 30) self.test_map.mapData.append(self.test_person_3) self.test_person.map = self.test_map self.test_person.flock()