

def test_json(self):
    test_layout3 = ' ##################\n            #0#.  .  # .     #\n            #1#####    #####2#\n            #     . #  .  .#3#\n            ################## '
    universe = CTFUniverse.create(universe_json, 4)
    maze_data = universe.maze._data
    universe_json = {
        'maze': {
            'height': 5,
            'width': 18,
            'data': maze_data[:],
        },
        'food': [(6, 1), (3, 1), (11, 3), (6, 3), (11, 1), (14, 3)],
        'teams': [{
            'score': 0,
            'zone': (0, 8),
            'index': 0,
        }, {
            'score': 0,
            'zone': (9, 17),
            'index': 1,
        }],
        'bots': [{
            'team_index': 0,
            'homezone': (0, 8),
            'noisy': False,
            'current_pos': (1, 1),
            'index': 0,
            'initial_pos': (1, 1),
        }, {
            'team_index': 1,
            'homezone': (9, 17),
            'noisy': False,
            'current_pos': (1, 2),
            'index': 1,
            'initial_pos': (1, 2),
        }, {
            'team_index': 0,
            'homezone': (0, 8),
            'noisy': False,
            'current_pos': (16, 2),
            'index': 2,
            'initial_pos': (16, 2),
        }, {
            'team_index': 1,
            'homezone': (9, 17),
            'noisy': False,
            'current_pos': (16, 3),
            'index': 3,
            'initial_pos': (16, 3),
        }],
    }
    universe_dict = universe._to_json_dict()
    universe_dict['food'].sort()
    universe_json['food'].sort()
    self.assertEqual(universe_json, universe_dict)
    universe2 = CTFUniverse._from_json_dict(universe_json)
    self.assertEqual(universe, universe2)

dataset/ETHPy150Open ASPP/pelita/test/test_datamodel.py TestCTFUniverse.test_json/VarMisuse@20/76 `test_layout3`->`universe_json`