From 228dfaae60f5030a4f62ac81b1ec26e25f3562b0 Mon Sep 17 00:00:00 2001 From: Alex Gilbert Date: Sun, 8 Oct 2023 21:32:47 -0400 Subject: [PATCH] Improve options, fix all issues I hope --- worlds/stardew_valley/__init__.py | 2 +- worlds/stardew_valley/options.py | 79 ++++++++-------- worlds/stardew_valley/test/TestOptions.py | 94 ++++++++++--------- .../test/checks/option_checks.py | 4 +- .../stardew_valley/test/long/TestModsLong.py | 63 +++++++++++++ .../test/long/TestOptionsLong.py | 7 +- .../test/long/TestRandomWorlds.py | 9 +- .../stardew_valley/test/long/option_names.py | 6 +- worlds/stardew_valley/test/mods/TestMods.py | 44 ++------- 9 files changed, 174 insertions(+), 134 deletions(-) create mode 100644 worlds/stardew_valley/test/long/TestModsLong.py diff --git a/worlds/stardew_valley/__init__.py b/worlds/stardew_valley/__init__.py index 1d367654d666..6d805cdf8995 100644 --- a/worlds/stardew_valley/__init__.py +++ b/worlds/stardew_valley/__init__.py @@ -86,7 +86,7 @@ def force_change_options_if_incompatible(self): goal_is_island_related = goal_is_walnut_hunter or goal_is_perfection exclude_ginger_island = self.options.exclude_ginger_island == options.ExcludeGingerIsland.option_true if goal_is_island_related and exclude_ginger_island: - self.options.exclude_ginger_island = options.ExcludeGingerIsland.option_false + self.options.exclude_ginger_island.value = options.ExcludeGingerIsland.option_false goal_name = self.options.goal.current_key player_name = self.multiworld.player_name[self.player] logging.warning(f"Goal '{goal_name}' requires Ginger Island. Exclude Ginger Island setting forced to 'False' for player {self.player} ({player_name})") diff --git a/worlds/stardew_valley/options.py b/worlds/stardew_valley/options.py index 72bc770a012c..e008f622b8e3 100644 --- a/worlds/stardew_valley/options.py +++ b/worlds/stardew_valley/options.py @@ -1,6 +1,7 @@ from dataclasses import dataclass +from typing import Dict -from Options import Range, SpecialRange, Toggle, Choice, OptionSet, PerGameCommonOptions, DeathLink +from Options import Range, SpecialRange, Toggle, Choice, OptionSet, PerGameCommonOptions, DeathLink, Option from .mods.mod_data import ModNames @@ -569,41 +570,41 @@ class StardewValleyOptions(PerGameCommonOptions): mods: Mods death_link: DeathLink - -stardew_valley_option_classes = { - Goal, - StartingMoney, - ProfitMargin, - BundleRandomization, - BundlePrice, - EntranceRandomization, - SeasonRandomization, - Cropsanity, - BackpackProgression, - ToolProgression, - SkillProgression, - BuildingProgression, - FestivalLocations, - ElevatorProgression, - ArcadeMachineLocations, - SpecialOrderLocations, - HelpWantedLocations, - Fishsanity, - Museumsanity, - Friendsanity, - FriendsanityHeartSize, - NumberOfMovementBuffs, - NumberOfLuckBuffs, - ExcludeGingerIsland, - TrapItems, - MultipleDaySleepEnabled, - MultipleDaySleepCost, - ExperienceMultiplier, - FriendshipMultiplier, - DebrisMultiplier, - QuickStart, - Gifting, - Mods, -} - -stardew_valley_option_names = {option.internal_name for option in stardew_valley_option_classes} + def get_option_value(self, name: str) -> int: + return self.get_options_by_name()[name].value + + def get_options_by_name(self): + return { + self.goal.internal_name: self.goal, + self.starting_money.internal_name: self.starting_money, + self.profit_margin.internal_name: self.profit_margin, + self.bundle_randomization.internal_name: self.bundle_randomization, + self.bundle_price.internal_name: self.bundle_price, + self.entrance_randomization.internal_name: self.entrance_randomization, + self.season_randomization.internal_name: self.season_randomization, + self.cropsanity.internal_name: self.cropsanity, + self.backpack_progression.internal_name: self.backpack_progression, + self.tool_progression.internal_name: self.tool_progression, + self.skill_progression.internal_name: self.skill_progression, + self.building_progression.internal_name: self.building_progression, + self.festival_locations.internal_name: self.festival_locations, + self.elevator_progression.internal_name: self.elevator_progression, + self.arcade_machine_locations.internal_name: self.arcade_machine_locations, + self.special_order_locations.internal_name: self.special_order_locations, + self.help_wanted_locations.internal_name: self.help_wanted_locations, + self.fishsanity.internal_name: self.fishsanity, + self.museumsanity.internal_name: self.museumsanity, + self.friendsanity.internal_name: self.friendsanity, + self.friendsanity_heart_size.internal_name: self.friendsanity_heart_size, + self.number_of_movement_buffs.internal_name: self.number_of_movement_buffs, + self.number_of_luck_buffs.internal_name: self.number_of_luck_buffs, + self.exclude_ginger_island.internal_name: self.exclude_ginger_island, + self.trap_items.internal_name: self.trap_items, + self.multiple_day_sleep_enabled.internal_name: self.multiple_day_sleep_enabled, + self.multiple_day_sleep_cost.internal_name: self.multiple_day_sleep_cost, + self.experience_multiplier.internal_name: self.experience_multiplier, + self.friendship_multiplier.internal_name: self.friendship_multiplier, + self.debris_multiplier.internal_name: self.debris_multiplier, + self.quick_start.internal_name: self.quick_start, + self.gifting.internal_name: self.gifting, + } diff --git a/worlds/stardew_valley/test/TestOptions.py b/worlds/stardew_valley/test/TestOptions.py index 595a165384db..0dd83010c6c4 100644 --- a/worlds/stardew_valley/test/TestOptions.py +++ b/worlds/stardew_valley/test/TestOptions.py @@ -5,10 +5,10 @@ from BaseClasses import ItemClassification, MultiWorld from Options import SpecialRange from . import setup_solo_multiworld, SVTestBase -from .. import StardewItem, options, items_by_group, Group, StardewValleyWorld +from .. import StardewItem, items_by_group, Group, StardewValleyWorld from ..locations import locations_by_tag, LocationTags, location_table -from ..options import stardew_valley_option_classes -from ..strings.goal_names import Goal +from ..options import ExcludeGingerIsland, ToolProgression, Goal, SeasonRandomization, TrapItems, SpecialOrderLocations, ArcadeMachineLocations +from ..strings.goal_names import Goal as GoalName from ..strings.season_names import Season from ..strings.special_order_names import SpecialOrder from ..strings.tool_names import ToolMaterial, Tool @@ -50,9 +50,10 @@ def get_option_choices(option) -> Dict[str, int]: class TestGenerateDynamicOptions(SVTestBase): def test_given_special_range_when_generate_then_basic_checks(self): - for option in stardew_valley_option_classes: - option_name = option.internal_name - if not issubclass(option, SpecialRange): + options = self.world.options.get_options_by_name() + for option_name in options: + option = options[option_name] + if not isinstance(option, SpecialRange): continue for value in option.special_range_names: with self.subTest(f"{option_name}: {value}"): @@ -62,8 +63,9 @@ def test_given_special_range_when_generate_then_basic_checks(self): def test_given_choice_when_generate_then_basic_checks(self): seed = int(random() * pow(10, 18) - 1) - for option in stardew_valley_option_classes: - option_name = option.internal_name + options = self.world.options.get_options_by_name() + for option_name in options: + option = options[option_name] if not option.options: continue for value in option.options: @@ -75,16 +77,16 @@ def test_given_choice_when_generate_then_basic_checks(self): class TestGoal(SVTestBase): def test_given_goal_when_generate_then_victory_is_in_correct_location(self): - for goal, location in [("community_center", Goal.community_center), - ("grandpa_evaluation", Goal.grandpa_evaluation), - ("bottom_of_the_mines", Goal.bottom_of_the_mines), - ("cryptic_note", Goal.cryptic_note), - ("master_angler", Goal.master_angler), - ("complete_collection", Goal.complete_museum), - ("full_house", Goal.full_house), - ("perfection", Goal.perfection)]: + for goal, location in [("community_center", GoalName.community_center), + ("grandpa_evaluation", GoalName.grandpa_evaluation), + ("bottom_of_the_mines", GoalName.bottom_of_the_mines), + ("cryptic_note", GoalName.cryptic_note), + ("master_angler", GoalName.master_angler), + ("complete_collection", GoalName.complete_museum), + ("full_house", GoalName.full_house), + ("perfection", GoalName.perfection)]: with self.subTest(msg=f"Goal: {goal}, Location: {location}"): - world_options = {options.Goal.internal_name: options.Goal.options[goal]} + world_options = {Goal.internal_name: Goal.options[goal]} multi_world = setup_solo_multiworld(world_options) victory = multi_world.find_item("Victory", 1) self.assertEqual(victory.name, location) @@ -92,14 +94,14 @@ def test_given_goal_when_generate_then_victory_is_in_correct_location(self): class TestSeasonRandomization(SVTestBase): def test_given_disabled_when_generate_then_all_seasons_are_precollected(self): - world_options = {options.SeasonRandomization.internal_name: options.SeasonRandomization.option_disabled} + world_options = {SeasonRandomization.internal_name: SeasonRandomization.option_disabled} multi_world = setup_solo_multiworld(world_options) precollected_items = {item.name for item in multi_world.precollected_items[1]} self.assertTrue(all([season in precollected_items for season in SEASONS])) def test_given_randomized_when_generate_then_all_seasons_are_in_the_pool_or_precollected(self): - world_options = {options.SeasonRandomization.internal_name: options.SeasonRandomization.option_randomized} + world_options = {SeasonRandomization.internal_name: SeasonRandomization.option_randomized} multi_world = setup_solo_multiworld(world_options) precollected_items = {item.name for item in multi_world.precollected_items[1]} items = {item.name for item in multi_world.get_items()} | precollected_items @@ -107,7 +109,7 @@ def test_given_randomized_when_generate_then_all_seasons_are_in_the_pool_or_prec self.assertEqual(len(SEASONS.intersection(precollected_items)), 1) def test_given_progressive_when_generate_then_3_progressive_seasons_are_in_the_pool(self): - world_options = {options.SeasonRandomization.internal_name: options.SeasonRandomization.option_progressive} + world_options = {SeasonRandomization.internal_name: SeasonRandomization.option_progressive} multi_world = setup_solo_multiworld(world_options) items = [item.name for item in multi_world.get_items()] @@ -116,7 +118,7 @@ def test_given_progressive_when_generate_then_3_progressive_seasons_are_in_the_p class TestToolProgression(SVTestBase): def test_given_vanilla_when_generate_then_no_tool_in_pool(self): - world_options = {options.ToolProgression.internal_name: options.ToolProgression.option_vanilla} + world_options = {ToolProgression.internal_name: ToolProgression.option_vanilla} multi_world = setup_solo_multiworld(world_options) items = {item.name for item in multi_world.get_items()} @@ -124,7 +126,7 @@ def test_given_vanilla_when_generate_then_no_tool_in_pool(self): self.assertNotIn(tool, items) def test_given_progressive_when_generate_then_progressive_tool_of_each_is_in_pool_four_times(self): - world_options = {options.ToolProgression.internal_name: options.ToolProgression.option_progressive} + world_options = {ToolProgression.internal_name: ToolProgression.option_progressive} multi_world = setup_solo_multiworld(world_options) items = [item.name for item in multi_world.get_items()] @@ -132,7 +134,7 @@ def test_given_progressive_when_generate_then_progressive_tool_of_each_is_in_poo self.assertEqual(items.count("Progressive " + tool), 4) def test_given_progressive_when_generate_then_tool_upgrades_are_locations(self): - world_options = {options.ToolProgression.internal_name: options.ToolProgression.option_progressive} + world_options = {ToolProgression.internal_name: ToolProgression.option_progressive} multi_world = setup_solo_multiworld(world_options) locations = {locations.name for locations in multi_world.get_locations(1)} @@ -149,44 +151,44 @@ def test_given_progressive_when_generate_then_tool_upgrades_are_locations(self): class TestGenerateAllOptionsWithExcludeGingerIsland(SVTestBase): def test_given_special_range_when_generate_exclude_ginger_island(self): - for option in stardew_valley_option_classes: - option_name = option.internal_name - if not issubclass(option, - SpecialRange) or option_name == options.ExcludeGingerIsland.internal_name: + options = self.world.options.get_options_by_name() + for option_name in options: + option = options[option_name] + if not isinstance(option, SpecialRange) or option_name == ExcludeGingerIsland.internal_name: continue for value in option.special_range_names: with self.subTest(f"{option_name}: {value}"): multiworld = setup_solo_multiworld( - {options.ExcludeGingerIsland.internal_name: options.ExcludeGingerIsland.option_true, + {ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, option_name: option.special_range_names[value]}) check_no_ginger_island(self, multiworld) def test_given_choice_when_generate_exclude_ginger_island(self): seed = int(random() * pow(10, 18) - 1) - island_option = options.ExcludeGingerIsland - for option in stardew_valley_option_classes: - option_name = option.internal_name - if not option.options or option_name == island_option.internal_name: + options = self.world.options.get_options_by_name() + for option_name in options: + option = options[option_name] + if not option.options or option_name == ExcludeGingerIsland.internal_name: continue for value in option.options: with self.subTest(f"{option_name}: {value} [Seed: {seed}]"): multiworld = setup_solo_multiworld( - {island_option.internal_name: island_option.option_true, + {ExcludeGingerIsland.internal_name: ExcludeGingerIsland.option_true, option_name: option.options[value]}, seed) stardew_world: StardewValleyWorld = multiworld.worlds[self.player] - if stardew_world.options.exclude_ginger_island != island_option.option_true: + if stardew_world.options.exclude_ginger_island != ExcludeGingerIsland.option_true: continue basic_checks(self, multiworld) check_no_ginger_island(self, multiworld) def test_given_island_related_goal_then_override_exclude_ginger_island(self): - island_goals = [value for value in options.Goal.options if value in ["walnut_hunter", "perfection"]] - island_option = options.ExcludeGingerIsland + island_goals = [value for value in Goal.options if value in ["walnut_hunter", "perfection"]] + island_option = ExcludeGingerIsland for goal in island_goals: for value in island_option.options: with self.subTest(f"Goal: {goal}, {island_option.internal_name}: {value}"): multiworld = setup_solo_multiworld( - {options.Goal.internal_name: options.Goal.options[goal], + {Goal.internal_name: Goal.options[goal], island_option.internal_name: island_option.options[value]}) stardew_world: StardewValleyWorld = multiworld.worlds[self.player] self.assertEqual(stardew_world.options.exclude_ginger_island, island_option.option_false) @@ -196,7 +198,7 @@ def test_given_island_related_goal_then_override_exclude_ginger_island(self): class TestTraps(SVTestBase): def test_given_no_traps_when_generate_then_no_trap_in_pool(self): world_options = self.allsanity_options_without_mods() - world_options.update({options.TrapItems.internal_name: options.TrapItems.option_no_traps}) + world_options.update({TrapItems.internal_name: TrapItems.option_no_traps}) multi_world = setup_solo_multiworld(world_options) trap_items = [item_data.name for item_data in items_by_group[Group.TRAP]] @@ -207,12 +209,12 @@ def test_given_no_traps_when_generate_then_no_trap_in_pool(self): self.assertNotIn(item, multiworld_items) def test_given_traps_when_generate_then_all_traps_in_pool(self): - trap_option = options.TrapItems + trap_option = TrapItems for value in trap_option.options: if value == "no_traps": continue world_options = self.allsanity_options_with_mods() - world_options.update({options.TrapItems.internal_name: trap_option.options[value]}) + world_options.update({TrapItems.internal_name: trap_option.options[value]}) multi_world = setup_solo_multiworld(world_options) trap_items = [item_data.name for item_data in items_by_group[Group.TRAP] if Group.DEPRECATED not in item_data.groups and item_data.mod_name is None] multiworld_items = [item.name for item in multi_world.get_items()] @@ -223,7 +225,7 @@ def test_given_traps_when_generate_then_all_traps_in_pool(self): class TestSpecialOrders(SVTestBase): def test_given_disabled_then_no_order_in_pool(self): - world_options = {options.SpecialOrderLocations.internal_name: options.SpecialOrderLocations.option_disabled} + world_options = {SpecialOrderLocations.internal_name: SpecialOrderLocations.option_disabled} multi_world = setup_solo_multiworld(world_options) locations_in_pool = {location.name for location in multi_world.get_locations() if location.name in location_table} @@ -233,7 +235,7 @@ def test_given_disabled_then_no_order_in_pool(self): self.assertNotIn(LocationTags.SPECIAL_ORDER_QI, location.tags) def test_given_board_only_then_no_qi_order_in_pool(self): - world_options = {options.SpecialOrderLocations.internal_name: options.SpecialOrderLocations.option_board_only} + world_options = {SpecialOrderLocations.internal_name: SpecialOrderLocations.option_board_only} multi_world = setup_solo_multiworld(world_options) locations_in_pool = {location.name for location in multi_world.get_locations() if location.name in location_table} @@ -247,8 +249,8 @@ def test_given_board_only_then_no_qi_order_in_pool(self): self.assertIn(board_location.name, locations_in_pool) def test_given_board_and_qi_then_all_orders_in_pool(self): - world_options = {options.SpecialOrderLocations.internal_name: options.SpecialOrderLocations.option_board_qi, - options.ArcadeMachineLocations.internal_name: options.ArcadeMachineLocations.option_victories} + world_options = {SpecialOrderLocations.internal_name: SpecialOrderLocations.option_board_qi, + ArcadeMachineLocations.internal_name: ArcadeMachineLocations.option_victories} multi_world = setup_solo_multiworld(world_options) locations_in_pool = {location.name for location in multi_world.get_locations()} @@ -263,8 +265,8 @@ def test_given_board_and_qi_then_all_orders_in_pool(self): self.assertIn(board_location.name, locations_in_pool) def test_given_board_and_qi_without_arcade_machines_then_lets_play_a_game_not_in_pool(self): - world_options = {options.SpecialOrderLocations.internal_name: options.SpecialOrderLocations.option_board_qi, - options.ArcadeMachineLocations.internal_name: options.ArcadeMachineLocations.option_disabled} + world_options = {SpecialOrderLocations.internal_name: SpecialOrderLocations.option_board_qi, + ArcadeMachineLocations.internal_name: ArcadeMachineLocations.option_disabled} multi_world = setup_solo_multiworld(world_options) locations_in_pool = {location.name for location in multi_world.get_locations()} diff --git a/worlds/stardew_valley/test/checks/option_checks.py b/worlds/stardew_valley/test/checks/option_checks.py index e6bced5b1ce7..35e9e6156e0b 100644 --- a/worlds/stardew_valley/test/checks/option_checks.py +++ b/worlds/stardew_valley/test/checks/option_checks.py @@ -20,7 +20,7 @@ def is_setting(multiworld: MultiWorld, setting_name: str, setting_value: int) -> stardew_world = get_stardew_world(multiworld) if not stardew_world: return False - current_value = stardew_world.options[setting_name] + current_value = stardew_world.options.get_option_value(setting_name) return current_value == setting_value @@ -32,7 +32,7 @@ def assert_is_setting(tester: SVTestBase, multiworld: MultiWorld, setting_name: stardew_world = get_stardew_world(multiworld) if not stardew_world: return False - current_value = stardew_world.options[setting_name] + current_value = stardew_world.options.get_option_value(setting_name) tester.assertEqual(current_value, setting_value) diff --git a/worlds/stardew_valley/test/long/TestModsLong.py b/worlds/stardew_valley/test/long/TestModsLong.py new file mode 100644 index 000000000000..b3ec6f1420ad --- /dev/null +++ b/worlds/stardew_valley/test/long/TestModsLong.py @@ -0,0 +1,63 @@ +from typing import List, Union + +from BaseClasses import MultiWorld +from worlds.stardew_valley.mods.mod_data import ModNames +from worlds.stardew_valley.test import setup_solo_multiworld +from worlds.stardew_valley.test.TestOptions import basic_checks, SVTestBase +from worlds.stardew_valley.items import item_table +from worlds.stardew_valley.locations import location_table +from worlds.stardew_valley.options import Mods +from .option_names import options_to_include + +all_mods = frozenset({ModNames.deepwoods, ModNames.tractor, ModNames.big_backpack, + ModNames.luck_skill, ModNames.magic, ModNames.socializing_skill, ModNames.archaeology, + ModNames.cooking_skill, ModNames.binning_skill, ModNames.juna, + ModNames.jasper, ModNames.alec, ModNames.yoba, ModNames.eugene, + ModNames.wellwick, ModNames.ginger, ModNames.shiko, ModNames.delores, + ModNames.ayeisha, ModNames.riley, ModNames.skull_cavern_elevator}) + + +def check_stray_mod_items(chosen_mods: Union[List[str], str], tester: SVTestBase, multiworld: MultiWorld): + if isinstance(chosen_mods, str): + chosen_mods = [chosen_mods] + for multiworld_item in multiworld.get_items(): + item = item_table[multiworld_item.name] + tester.assertTrue(item.mod_name is None or item.mod_name in chosen_mods) + for multiworld_location in multiworld.get_locations(): + if multiworld_location.event: + continue + location = location_table[multiworld_location.name] + tester.assertTrue(location.mod_name is None or location.mod_name in chosen_mods) + + +class TestGenerateModsOptions(SVTestBase): + + def test_given_mod_pairs_when_generate_then_basic_checks(self): + if self.skip_long_tests: + return + mods = list(all_mods) + num_mods = len(mods) + for mod1_index in range(0, num_mods): + for mod2_index in range(mod1_index + 1, num_mods): + mod1 = mods[mod1_index] + mod2 = mods[mod2_index] + mod_pair = (mod1, mod2) + with self.subTest(f"Mods: {mod_pair}"): + multiworld = setup_solo_multiworld({Mods: mod_pair}) + basic_checks(self, multiworld) + check_stray_mod_items(list(mod_pair), self, multiworld) + + def test_given_mod_names_when_generate_paired_with_other_options_then_basic_checks(self): + if self.skip_long_tests: + return + num_options = len(options_to_include) + for option_index in range(0, num_options): + option = options_to_include[option_index] + if not option.options: + continue + for value in option.options: + for mod in all_mods: + with self.subTest(f"{option.internal_name}: {value}, Mod: {mod}"): + multiworld = setup_solo_multiworld({option.internal_name: option.options[value], Mods: mod}) + basic_checks(self, multiworld) + check_stray_mod_items(mod, self, multiworld) \ No newline at end of file diff --git a/worlds/stardew_valley/test/long/TestOptionsLong.py b/worlds/stardew_valley/test/long/TestOptionsLong.py index c614ddcc36fa..6de9c0820bae 100644 --- a/worlds/stardew_valley/test/long/TestOptionsLong.py +++ b/worlds/stardew_valley/test/long/TestOptionsLong.py @@ -24,10 +24,12 @@ class TestGenerateDynamicOptions(SVTestBase): def test_given_option_pair_when_generate_then_basic_checks(self): if self.skip_long_tests: return - + counter = 0 num_options = len(options_to_include) for option1_index in range(0, num_options): for option2_index in range(option1_index + 1, num_options): + if counter > 100: + return option1 = options_to_include[option1_index] option2 = options_to_include[option2_index] option1_choices = get_option_choices(option1) @@ -38,4 +40,5 @@ def test_given_option_pair_when_generate_then_basic_checks(self): choices = {option1.internal_name: option1_choices[key1], option2.internal_name: option2_choices[key2]} multiworld = setup_solo_multiworld(choices) - basic_checks(self, multiworld) \ No newline at end of file + basic_checks(self, multiworld) + counter = counter + 1 \ No newline at end of file diff --git a/worlds/stardew_valley/test/long/TestRandomWorlds.py b/worlds/stardew_valley/test/long/TestRandomWorlds.py index 6ba814aba2c4..e4d4350a3df7 100644 --- a/worlds/stardew_valley/test/long/TestRandomWorlds.py +++ b/worlds/stardew_valley/test/long/TestRandomWorlds.py @@ -1,4 +1,4 @@ -from typing import Dict, List +from typing import Dict import random from BaseClasses import MultiWorld @@ -9,7 +9,6 @@ from ..checks.option_checks import assert_can_reach_island_if_should, assert_cropsanity_same_number_items_and_locations, \ assert_festivals_give_access_to_deluxe_scarecrow from ..checks.world_checks import assert_same_number_items_locations, assert_victory_exists -from ... import options def get_option_choices(option) -> Dict[str, int]: @@ -91,9 +90,9 @@ def check_multiworld_is_valid(tester: SVTestBase, multiworld_id: int, multiworld class TestGenerateManyWorlds(SVTestBase): def test_generate_many_worlds_then_check_results(self): - if self.skip_long_tests: - return - number_worlds = 1000 + # if self.skip_long_tests: + # return + number_worlds = 100 start_index = random.Random().randint(0, 9999999999) multiworlds = generate_many_worlds(number_worlds, start_index) check_every_multiworld_is_valid(self, multiworlds) diff --git a/worlds/stardew_valley/test/long/option_names.py b/worlds/stardew_valley/test/long/option_names.py index b6b9fb2a6163..649d0da5b33f 100644 --- a/worlds/stardew_valley/test/long/option_names.py +++ b/worlds/stardew_valley/test/long/option_names.py @@ -1,8 +1,8 @@ -from ...options import stardew_valley_option_names +from ... import StardewValleyWorld options_to_exclude = ["profit_margin", "starting_money", "multiple_day_sleep_enabled", "multiple_day_sleep_cost", "experience_multiplier", "friendship_multiplier", "debris_multiplier", - "quick_start", "gifting", "gift_tax"] + "quick_start", "gifting", "gift_tax", "progression_balancing", "accessibility", "start_inventory", "start_hints", "death_link"] -options_to_include = [option_name for option_name in stardew_valley_option_names +options_to_include = [option for option_name, option in StardewValleyWorld.options_dataclass.type_hints.items() if option_name not in options_to_exclude] diff --git a/worlds/stardew_valley/test/mods/TestMods.py b/worlds/stardew_valley/test/mods/TestMods.py index 6a76f0478b7b..02fd30a6b11f 100644 --- a/worlds/stardew_valley/test/mods/TestMods.py +++ b/worlds/stardew_valley/test/mods/TestMods.py @@ -4,15 +4,14 @@ import sys from BaseClasses import MultiWorld -from worlds.stardew_valley.mods.mod_data import ModNames -from worlds.stardew_valley.test import setup_solo_multiworld -from worlds.stardew_valley.test.TestOptions import basic_checks, SVTestBase -from worlds.stardew_valley import items, Group, ItemClassification -from worlds.stardew_valley.regions import RandomizationFlag, create_final_connections, randomize_connections, create_final_regions -from worlds.stardew_valley.items import item_table, items_by_group -from worlds.stardew_valley.locations import location_table -from worlds.stardew_valley.options import stardew_valley_option_classes, Mods, EntranceRandomization, Friendsanity, SeasonRandomization, SpecialOrderLocations, \ - ExcludeGingerIsland, TrapItems +from ...mods.mod_data import ModNames +from .. import setup_solo_multiworld +from ..TestOptions import basic_checks, SVTestBase +from ... import items, Group, ItemClassification +from ...regions import RandomizationFlag, create_final_connections, randomize_connections, create_final_regions +from ...items import item_table, items_by_group +from ...locations import location_table +from ...options import Mods, EntranceRandomization, Friendsanity, SeasonRandomization, SpecialOrderLocations, ExcludeGingerIsland, TrapItems all_mods = frozenset({ModNames.deepwoods, ModNames.tractor, ModNames.big_backpack, ModNames.luck_skill, ModNames.magic, ModNames.socializing_skill, ModNames.archaeology, @@ -44,20 +43,6 @@ def test_given_single_mods_when_generate_then_basic_checks(self): basic_checks(self, multi_world) check_stray_mod_items(mod, self, multi_world) - def test_given_mod_pairs_when_generate_then_basic_checks(self): - if self.skip_long_tests: - return - num_mods = len(all_mods) - for mod1_index in range(0, num_mods): - for mod2_index in range(mod1_index + 1, num_mods): - mod1 = all_mods[mod1_index] - mod2 = all_mods[mod2_index] - mods = (mod1, mod2) - with self.subTest(f"Mods: {mods}"): - multiworld = setup_solo_multiworld({Mods: mods}) - basic_checks(self, multiworld) - check_stray_mod_items(list(mods), self, multiworld) - def test_given_mod_names_when_generate_paired_with_entrance_randomizer_then_basic_checks(self): for option in EntranceRandomization.options: for mod in all_mods: @@ -66,19 +51,6 @@ def test_given_mod_names_when_generate_paired_with_entrance_randomizer_then_basi basic_checks(self, multiworld) check_stray_mod_items(mod, self, multiworld) - def test_given_mod_names_when_generate_paired_with_other_options_then_basic_checks(self): - if self.skip_long_tests: - return - for option in stardew_valley_option_classes: - if not option.options: - continue - for value in option.options: - for mod in all_mods: - with self.subTest(f"{option.internal_name}: {value}, Mod: {mod}"): - multiworld = setup_solo_multiworld({option.internal_name: option.options[value], Mods: mod}) - basic_checks(self, multiworld) - check_stray_mod_items(mod, self, multiworld) - class TestBaseItemGeneration(SVTestBase): options = {