forked from mirror/Archipelago
* Stardew Valley: Test: unify mods * Stardew Valley: Test: don't use SVTestBase where setUp is unused * Stardew Valley: Test: remove duplicate backpack test * Stardew Valley: Test: remove 2,3,4 heart tests assume the math is correct with just 2 points on the curve * Stardew Valley: Test: reduce duplicate test/gen runs * Stardew Valley: Test: Change 'long' tests to not use TestBase TestBase' setUp is not being used in the changed TestCases * Stardew Valley: Test: Use subtests and inheritance for backpacks * Stardew Valley: Test: add flag to skip some of the extensive tests by default
33 lines
1.3 KiB
Python
33 lines
1.3 KiB
Python
import unittest
|
|
from typing import List
|
|
|
|
from BaseClasses import MultiWorld, ItemClassification
|
|
from ... import StardewItem
|
|
|
|
|
|
def get_all_item_names(multiworld: MultiWorld) -> List[str]:
|
|
return [item.name for item in multiworld.itempool]
|
|
|
|
|
|
def get_all_location_names(multiworld: MultiWorld) -> List[str]:
|
|
return [location.name for location in multiworld.get_locations() if not location.event]
|
|
|
|
|
|
def assert_victory_exists(tester: unittest.TestCase, multiworld: MultiWorld):
|
|
tester.assertIn(StardewItem("Victory", ItemClassification.progression, None, 1), multiworld.get_items())
|
|
|
|
|
|
def collect_all_then_assert_can_win(tester: unittest.TestCase, multiworld: MultiWorld):
|
|
for item in multiworld.get_items():
|
|
multiworld.state.collect(item)
|
|
tester.assertTrue(multiworld.find_item("Victory", 1).can_reach(multiworld.state))
|
|
|
|
|
|
def assert_can_win(tester: unittest.TestCase, multiworld: MultiWorld):
|
|
assert_victory_exists(tester, multiworld)
|
|
collect_all_then_assert_can_win(tester, multiworld)
|
|
|
|
|
|
def assert_same_number_items_locations(tester: unittest.TestCase, multiworld: MultiWorld):
|
|
non_event_locations = [location for location in multiworld.get_locations() if not location.event]
|
|
tester.assertEqual(len(multiworld.itempool), len(non_event_locations)) |