def test_add_agent(self): locator = TorusLocator(2, 5) agent = DummyAgent() locator.add_agent(agent, (0, 1)) self.assertIsNotNone(locator.get_allowed_moves(agent))
def test_allowed_moves(self): locator = TorusLocator(5, 6) agent = DummyAgent() locator.add_agent(agent, (0, 0)) locator.add_agent(DummyAgent(), (1, 1)) self.assertEquals(locator.get_allowed_moves(agent), {(0, 1), (0, 5), (1, 0), (1, 5), (4, 0), (4, 1), (4, 5)})
def test_neighbourhood_radius(self): locator = TorusLocator(5, 6, 2) agent = DummyAgent() locator.add_agent(agent, (0, 0)) self.assertEquals(locator.get_allowed_moves(agent), {(0, 1), (0, 5), (1, 0), (1, 1), (1, 5), (4, 0), (4, 1), (4, 5), (0, 2), (1, 2), (2, 2), (2, 1), (2, 0), (3, 0), (3, 1), (3, 2), (4, 2), (0, 4), (1, 4), (2, 4), (2, 5), (4, 4), (3, 4), (3, 5)})
def test_add_agent_random_position(self): locator = TorusLocator(2, 5) agent = DummyAgent() self.assertIsNotNone(locator.get_allowed_moves(agent))