def test_add_elevator_connections_to_patches_random(echoes_game_data): # Setup game = data_reader.decode_data(echoes_game_data) permalink = dataclasses.replace(Permalink.default(), layout_configuration=dataclasses.replace( LayoutConfiguration.default(), elevators=LayoutElevators.RANDOMIZED)) expected = dataclasses.replace(GamePatches.with_game(game), elevator_connection={ 589851: AreaLocation(1039999561, 1868895730), 1572998: AreaLocation(1039999561, 3479543630), 1966093: AreaLocation(2252328306, 408633584), 2097251: AreaLocation(1119434212, 3331021649), 136970379: AreaLocation(2252328306, 2068511343), 3342446: AreaLocation(1039999561, 3205424168), 3538975: AreaLocation(1119434212, 2806956034), 152: AreaLocation(1006255871, 2889020216), 393260: AreaLocation(464164546, 3145160350), 524321: AreaLocation(464164546, 900285955), 589949: AreaLocation(1006255871, 2278776548), 122: AreaLocation(464164546, 3528156989), 1245307: AreaLocation(1006255871, 1345979968), 2949235: AreaLocation(1006255871, 1287880522), 129: AreaLocation(1006255871, 2918020398), 2162826: AreaLocation(1006255871, 1660916974), 4522032: AreaLocation(1006255871, 3455543403), 38: AreaLocation(1119434212, 1473133138), 1245332: AreaLocation(2252328306, 2399252740), 1638535: AreaLocation(2252328306, 2556480432), }) # Run result = base_patches_factory.add_elevator_connections_to_patches( permalink.layout_configuration, Random(permalink.seed_number), GamePatches.with_game(game), ) # Assert assert result == expected
def test_add_elevator_connections_to_patches_vanilla(echoes_game_data): # Setup game = data_reader.decode_data(echoes_game_data) permalink = Permalink.default() # Run result = base_patches_factory.add_elevator_connections_to_patches( permalink.layout_configuration, Random(permalink.seed_number), GamePatches.with_game(game)) # Assert assert result == GamePatches.with_game(game)
def test_calculate_indices_no_item(mock_read_databases: MagicMock, echoes_pickup_database: PickupDatabase, empty_patches ): # Setup description = LayoutDescription( version=randovania.VERSION, permalink=Permalink.default(), patches=empty_patches, solver_path=() ) mock_read_databases.return_value = (None, echoes_pickup_database) # Run result = claris_randomizer._calculate_indices(description) # Assert mock_read_databases.assert_called_once_with(description.permalink.layout_configuration.game_data) useless_pickup = echoes_pickup_database.pickup_by_name(claris_randomizer._USELESS_PICKUP_NAME) useless_index = echoes_pickup_database.original_index(useless_pickup) assert result == [useless_index.index] * echoes_pickup_database.total_pickup_count
def test_calculate_indices_original(mock_read_databases: MagicMock, echoes_pickup_database: PickupDatabase, empty_patches ): # Setup description = LayoutDescription( version=randovania.VERSION, permalink=Permalink.default(), patches=empty_patches.assign_new_pickups(echoes_pickup_database.original_pickup_mapping.items()), solver_path=() ) mock_read_databases.return_value = (None, echoes_pickup_database) # Run result = claris_randomizer._calculate_indices(description) # Assert mock_read_databases.assert_called_once_with(description.permalink.layout_configuration.game_data) assert result == [ echoes_pickup_database.original_index(pickup).index for pickup in echoes_pickup_database.original_pickup_mapping.values() ]
def _description(empty_patches) -> LayoutDescription: return _create_description_mock(Permalink.default(), empty_patches)