def test_room_is_partially_adjacent_to_another_room_from_north(self): a, b = Room(width=3, height=3), Room(width=3, height=3) a.x, a.y, b.x, b.y = 1, 3, 0, 0 turfs = _get_adjacent_turfs(a, b) self.assertEqual(len(turfs), 2) self.assertEqual(turfs, (set([((0, 0), (1, 2)), ((1, 0), (2, 2))]), (0, -1)))
def test_two_fully_adjacent_rooms(self): a, b = Room(width=2, height=2), Room(width=2, height=2) a.x, a.y, b.x, b.y = 0, 0, 2, 0 turfs = _get_adjacent_turfs(a, b) self.assertEqual(len(turfs), 2) self.assertEqual(turfs, (set([((1, 0), (0, 0)), ((1, 1), (0, 1))]), (1, 0)))
def test_room_is_partially_adjacent_to_another_from_the_east(self): a, b = Room(width=3, height=3), Room(width=3, height=3) a.x, a.y, b.x, b.y = 0, 0, 3, 1 turfs = _get_adjacent_turfs(a, b) self.assertEqual(len(turfs), 2) self.assertEqual(turfs, (set([((2, 1), (0, 0)), ((2, 2), (0, 1))]), (1, 0)))
def test_two_unadjacent_rooms(self): a, b = Room(width=1, height=1), Room(width=1, height=1) a.x, a.y, b.x, b.y = 0, 0, 2, 2 self.assertEqual(_get_adjacent_turfs(a, b), (set(), (None, None)))