

def test_factory(self):
    test_layout3 = ' ##################\n            #0#.  .  # .     #\n            #1#####    #####2#\n            #     . #  .  .#3#\n            ################## '
    universe = CTFUniverse.create(test_layout3, 4)
    target_mesh = Mesh(18, 5, data=list(('################### #.  .  # .     #' + '# #####    ##### ##     . #  .  .# ###################')))
    (target_mesh, target_food) = create_maze(target_mesh)
    self.assertEqual(target_mesh, universe.maze)
    target_food_list = [(3, 1), (6, 1), (11, 1), (6, 3), (11, 3), (14, 3)]
    self.assertCountEqual(target_food_list, universe.food_list)
    team_black_food = [(3, 1), (6, 1), (6, 3)]
    team_white_food = [(11, 1), (11, 3), (14, 3)]
    self.assertCountEqual(universe.team_food(0), team_black_food)
    self.assertCountEqual(universe.enemy_food(0), team_white_food)
    self.assertCountEqual(universe.team_food(1), team_white_food)
    self.assertCountEqual(universe.enemy_food(1), team_black_food)
    self.assertEqual([b.initial_pos for b in universe.bots], [(1, 1), (1, 2), (16, 2), (16, 3)])
    self.assertEqual([universe.bots[0]], universe.other_team_bots(2))
    self.assertEqual([universe.bots[1]], universe.other_team_bots(3))
    self.assertEqual([universe.bots[2]], universe.other_team_bots(0))
    self.assertEqual([universe.bots[3]], universe.other_team_bots(1))
    self.assertEqual([universe.bots[i] for i in (0, 2)], universe.team_bots(0))
    self.assertEqual([universe.bots[i] for i in (0, 2)], universe.enemy_bots(1))
    self.assertEqual([universe.bots[i] for i in (1, 3)], universe.team_bots(1))
    self.assertEqual([universe.bots[i] for i in (1, 3)], universe.enemy_bots(0))
    self.assertEqual(universe.enemy_team(0), universe.teams[1])
    self.assertEqual(universe.enemy_team(1), universe.teams[0])
    self.assertEqual([(8, 1), (8, 2)], universe.team_border(0))
    self.assertEqual([(9, 2), (9, 3)], universe.team_border(1))
    odd_layout = ' #####\n                #0 1#\n                ##### '
    self.assertRaises(UniverseException, CTFUniverse.create, odd_layout, 2)
    odd_bots = ' ####\n                #01#\n                #2 #\n                #### '
    self.assertRaises(UniverseException, CTFUniverse.create, odd_bots, 3)

dataset/ETHPy150Open ASPP/pelita/test/test_datamodel.py TestCTFUniverse.test_factory/original