def test_get_worker(self): level = self.make_level_simple() world = World(level) tile = world.get((4, 1)) self.assertEqual(tile.worker, True)
def test_get_dock(self): level = self.make_level_simple() world = World(level) tile = world.get((1, 1)) self.assertEqual(tile.dock, True)
def test_get_box(self): level = self.make_level_simple() world = World(level) tile = world.get((2, 1)) self.assertEqual(tile.box, True)
def test_get_floor(self): level = self.make_level_simple() world = World(level) tile = world.get((1, 1)) self.assertEqual(tile.wall, False)
def test_get_wall(self): level = self.make_level_simple() world = World(level) tile = world.get((0, 0)) self.assertEqual(tile.wall, True)
def test_push_box(self): level = self.make_level_simple() world = World(level) world.push_box((2, 1), (1, 1)) tile = world.get((1, 1)) self.assertEqual(tile.box, True) self.assertEqual(tile.dock, True)
def test_worker_in_dock(self): level = self.make_level_with_worker_on_dock() world = World(level) self.assertIn((2, 2), world.dock_pos) self.assertIn((2, 2), world.worker_pos)
def test_box_in_dock(self): level = self.make_level_with_box_in_dock() world = World(level) self.assertIn((2, 1), world.box_pos) self.assertIn((2, 1), world.dock_pos)
def test_atleast_one_worker_error(self): level = self.make_level_with_no_worker() with self.assertRaisesRegex(ValueError, 'worker not found'): World(level)
def test_multiple_dock_pos(self): level = self.make_level_with_multiple_boxes() world = World(level) self.assertEqual(world.dock_pos, [(1, 1), (2, 2)])
def test_dock_pos(self): level = self.make_level_simple() world = World(level) self.assertEqual(world.dock_pos, [(1, 1)])
def test_box_pos(self): level = self.make_level_simple() world = World(level) self.assertEqual(world.box_pos, [(2, 1)])
def test_worker_pos(self): level = self.make_level_simple() world = World(level) self.assertEqual(world.worker_pos, [(4, 1)])
def test_level_with_no_boxes(self): level = self.make_level_with_no_boxes() with self.assertRaisesRegex(ValueError, "boxes not found"): World(level)
def test_invalid_character(self): level = ["ABCD"] with self.assertRaisesRegex(ValueError, "character not recognized"): World(level)
def test_unbalanced_box_docks_error(self): level = self.make_level_with_unbalanced_box_docks() with self.assertRaisesRegex(ValueError, "count mismatch"): World(level)