From 9592af12850accdef2c5c458ee1564f0db5f75e6 Mon Sep 17 00:00:00 2001 From: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Date: Thu, 22 May 2025 10:35:50 -0400 Subject: [PATCH] Revert "Stardew Valley: Move and Rework Monstersanity Tests (#4911)" This reverts commit 984df75f837044aa55168816109ea284efba52f2. --- worlds/stardew_valley/test/TestGeneration.py | 159 ++++++++++++++++++ .../stardew_valley/test/TestMonstersanity.py | 132 --------------- 2 files changed, 159 insertions(+), 132 deletions(-) delete mode 100644 worlds/stardew_valley/test/TestMonstersanity.py diff --git a/worlds/stardew_valley/test/TestGeneration.py b/worlds/stardew_valley/test/TestGeneration.py index 5e60f8e80a..1e843ea690 100644 --- a/worlds/stardew_valley/test/TestGeneration.py +++ b/worlds/stardew_valley/test/TestGeneration.py @@ -120,6 +120,165 @@ class TestNoGingerIslandItemGeneration(SVTestBase): self.assertTrue(count == 0 or count == 2) +class TestMonstersanityNone(SVTestBase): + options = { + options.Monstersanity.internal_name: options.Monstersanity.option_none, + # Not really necessary, but it adds more locations, so we don't have to remove useful items. + options.Fishsanity.internal_name: options.Fishsanity.option_all + } + + @property + def run_default_tests(self) -> bool: + # None is default + return False + + def test_when_generate_world_then_5_generic_weapons_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Weapon"), 5) + + def test_when_generate_world_then_zero_specific_weapons_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Sword"), 0) + self.assertEqual(item_pool.count("Progressive Club"), 0) + self.assertEqual(item_pool.count("Progressive Dagger"), 0) + + def test_when_generate_world_then_2_slingshots_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Slingshot"), 2) + + def test_when_generate_world_then_3_shoes_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Footwear"), 3) + + +class TestMonstersanityGoals(SVTestBase): + options = {options.Monstersanity.internal_name: options.Monstersanity.option_goals} + + def test_when_generate_world_then_no_generic_weapons_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Weapon"), 0) + + def test_when_generate_world_then_5_specific_weapons_of_each_type_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Sword"), 5) + self.assertEqual(item_pool.count("Progressive Club"), 5) + self.assertEqual(item_pool.count("Progressive Dagger"), 5) + + def test_when_generate_world_then_2_slingshots_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Slingshot"), 2) + + def test_when_generate_world_then_4_shoes_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Footwear"), 4) + + def test_when_generate_world_then_all_monster_checks_are_inaccessible(self): + for location in self.get_real_locations(): + if LocationTags.MONSTERSANITY not in location_table[location.name].tags: + continue + with self.subTest(location.name): + self.assertFalse(location.can_reach(self.multiworld.state)) + + +class TestMonstersanityOnePerCategory(SVTestBase): + options = {options.Monstersanity.internal_name: options.Monstersanity.option_one_per_category} + + def test_when_generate_world_then_no_generic_weapons_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Weapon"), 0) + + def test_when_generate_world_then_5_specific_weapons_of_each_type_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Sword"), 5) + self.assertEqual(item_pool.count("Progressive Club"), 5) + self.assertEqual(item_pool.count("Progressive Dagger"), 5) + + def test_when_generate_world_then_2_slingshots_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Slingshot"), 2) + + def test_when_generate_world_then_4_shoes_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Footwear"), 4) + + def test_when_generate_world_then_all_monster_checks_are_inaccessible(self): + for location in self.get_real_locations(): + if LocationTags.MONSTERSANITY not in location_table[location.name].tags: + continue + with self.subTest(location.name): + self.assertFalse(location.can_reach(self.multiworld.state)) + + +class TestMonstersanityProgressive(SVTestBase): + options = {options.Monstersanity.internal_name: options.Monstersanity.option_progressive_goals} + + def test_when_generate_world_then_no_generic_weapons_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Weapon"), 0) + + def test_when_generate_world_then_5_specific_weapons_of_each_type_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Sword"), 5) + self.assertEqual(item_pool.count("Progressive Club"), 5) + self.assertEqual(item_pool.count("Progressive Dagger"), 5) + + def test_when_generate_world_then_2_slingshots_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Slingshot"), 2) + + def test_when_generate_world_then_4_shoes_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Footwear"), 4) + + def test_when_generate_world_then_many_rings_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertIn("Hot Java Ring", item_pool) + self.assertIn("Wedding Ring", item_pool) + self.assertIn("Slime Charmer Ring", item_pool) + + def test_when_generate_world_then_all_monster_checks_are_inaccessible(self): + for location in self.get_real_locations(): + if LocationTags.MONSTERSANITY not in location_table[location.name].tags: + continue + with self.subTest(location.name): + self.assertFalse(location.can_reach(self.multiworld.state)) + + +class TestMonstersanitySplit(SVTestBase): + options = {options.Monstersanity.internal_name: options.Monstersanity.option_split_goals} + + def test_when_generate_world_then_no_generic_weapons_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Weapon"), 0) + + def test_when_generate_world_then_5_specific_weapons_of_each_type_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Sword"), 5) + self.assertEqual(item_pool.count("Progressive Club"), 5) + self.assertEqual(item_pool.count("Progressive Dagger"), 5) + + def test_when_generate_world_then_2_slingshots_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Slingshot"), 2) + + def test_when_generate_world_then_4_shoes_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertEqual(item_pool.count("Progressive Footwear"), 4) + + def test_when_generate_world_then_many_rings_in_the_pool(self): + item_pool = [item.name for item in self.multiworld.itempool] + self.assertIn("Hot Java Ring", item_pool) + self.assertIn("Wedding Ring", item_pool) + self.assertIn("Slime Charmer Ring", item_pool) + + def test_when_generate_world_then_all_monster_checks_are_inaccessible(self): + for location in self.get_real_locations(): + if LocationTags.MONSTERSANITY not in location_table[location.name].tags: + continue + with self.subTest(location.name): + self.assertFalse(location.can_reach(self.multiworld.state)) + + class TestProgressiveElevator(SVTestBase): options = { options.ElevatorProgression.internal_name: options.ElevatorProgression.option_progressive, diff --git a/worlds/stardew_valley/test/TestMonstersanity.py b/worlds/stardew_valley/test/TestMonstersanity.py deleted file mode 100644 index 8393715474..0000000000 --- a/worlds/stardew_valley/test/TestMonstersanity.py +++ /dev/null @@ -1,132 +0,0 @@ -import unittest -from typing import ClassVar - -from . import SVTestBase -from .. import options -from ..locations import LocationTags, location_table -from ..mods.mod_data import ModNames - - -class SVMonstersanityTestBase(SVTestBase): - expected_progressive_generic_weapon: ClassVar[int] = 0 - expected_progressive_specific_weapon: ClassVar[int] = 0 - expected_progressive_slingshot: ClassVar[int] = 0 - expected_progressive_footwear: ClassVar[int] = 0 - expected_rings: ClassVar[list[str]] = [] - - @classmethod - def setUpClass(cls) -> None: - if cls is SVMonstersanityTestBase: - raise unittest.SkipTest("Base tests disabled") - - super().setUpClass() - - def test_when_generate_world_then_expected_generic_weapons_in_the_pool(self): - item_pool = [item.name for item in self.multiworld.itempool] - self.assertEqual(item_pool.count("Progressive Weapon"), self.expected_progressive_generic_weapon) - - def test_when_generate_world_then_expected_specific_weapons_in_the_pool(self): - item_pool = [item.name for item in self.multiworld.itempool] - self.assertEqual(item_pool.count("Progressive Sword"), self.expected_progressive_specific_weapon) - self.assertEqual(item_pool.count("Progressive Club"), self.expected_progressive_specific_weapon) - self.assertEqual(item_pool.count("Progressive Dagger"), self.expected_progressive_specific_weapon) - - def test_when_generate_world_then_expected_slingshots_in_the_pool(self): - item_pool = [item.name for item in self.multiworld.itempool] - self.assertEqual(item_pool.count("Progressive Slingshot"), self.expected_progressive_slingshot) - - def test_when_generate_world_then_expected_shoes_in_the_pool(self): - item_pool = [item.name for item in self.multiworld.itempool] - self.assertEqual(item_pool.count("Progressive Footwear"), self.expected_progressive_footwear) - - def test_when_generate_world_then_many_rings_in_the_pool(self): - item_pool = [item.name for item in self.multiworld.itempool] - for expected_ring in self.expected_rings: - self.assertIn(expected_ring, item_pool) - - def test_when_generate_world_then_all_monster_checks_are_inaccessible_with_empty_inventory(self): - for location in self.get_real_locations(): - if LocationTags.MONSTERSANITY not in location_table[location.name].tags: - continue - with self.subTest(location.name): - self.assert_cannot_reach_location(location.name) - - -class TestMonstersanityNone(SVMonstersanityTestBase): - options = { - options.Monstersanity: options.Monstersanity.option_none, - # Not really necessary, but it adds more locations, so we don't have to remove useful items. - options.Fishsanity: options.Fishsanity.option_all, - } - expected_progressive_generic_weapon = 5 - expected_progressive_slingshot = 2 - expected_progressive_footwear = 3 - - @property - def run_default_tests(self) -> bool: - # None is default - return False - - -class TestMonstersanityNoneWithSVE(SVMonstersanityTestBase): - options = { - options.Monstersanity: options.Monstersanity.option_none, - options.Mods: ModNames.sve, - } - expected_progressive_generic_weapon = 6 - expected_progressive_slingshot = 2 - expected_progressive_footwear = 3 - - @property - def run_default_tests(self) -> bool: - # None is default - return False - - -class TestMonstersanityGoals(SVMonstersanityTestBase): - options = { - options.Monstersanity: options.Monstersanity.option_goals, - } - expected_progressive_specific_weapon = 5 - expected_progressive_slingshot = 2 - expected_progressive_footwear = 4 - - -class TestMonstersanityOnePerCategory(SVMonstersanityTestBase): - options = { - options.Monstersanity: options.Monstersanity.option_one_per_category, - } - expected_progressive_specific_weapon = 5 - expected_progressive_slingshot = 2 - expected_progressive_footwear = 4 - - -class TestMonstersanityProgressive(SVMonstersanityTestBase): - options = { - options.Monstersanity: options.Monstersanity.option_progressive_goals, - } - expected_progressive_specific_weapon = 5 - expected_progressive_slingshot = 2 - expected_progressive_footwear = 4 - expected_rings = ["Hot Java Ring", "Wedding Ring", "Slime Charmer Ring"] - - -class TestMonstersanitySplit(SVMonstersanityTestBase): - options = { - options.Monstersanity: options.Monstersanity.option_split_goals, - } - expected_progressive_specific_weapon = 5 - expected_progressive_slingshot = 2 - expected_progressive_footwear = 4 - expected_rings = ["Hot Java Ring", "Wedding Ring", "Slime Charmer Ring"] - - -class TestMonstersanitySplitWithSVE(SVMonstersanityTestBase): - options = { - options.Monstersanity: options.Monstersanity.option_split_goals, - options.Mods: ModNames.sve, - } - expected_progressive_specific_weapon = 6 - expected_progressive_slingshot = 2 - expected_progressive_footwear = 4 - expected_rings = ["Hot Java Ring", "Wedding Ring", "Slime Charmer Ring"]