The Messenger: Make modules and tests PEP8 (#2276)

* The Messenger: PEP8 module and test names

* fix dumb

* whitespace
This commit is contained in:
Aaron Wagener
2023-10-08 07:33:39 -05:00
committed by GitHub
parent cc2247bfa0
commit 6f9484f375
13 changed files with 65 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
from . import MessengerTestBase
from ..Constants import NOTES, PHOBEKINS
from ..constants import NOTES, PHOBEKINS
class AccessTest(MessengerTestBase):
@@ -7,7 +7,7 @@ class AccessTest(MessengerTestBase):
"shuffle_shards": "true",
}
def testTabi(self) -> None:
def test_tabi(self) -> None:
"""locations that hard require the Lightfoot Tabi"""
locations = [
"Searing Crags - Pyro", "Underworld - Key of Chaos", "Underworld Seal - Sharp and Windy Climb",
@@ -19,7 +19,7 @@ class AccessTest(MessengerTestBase):
items = [["Lightfoot Tabi"]]
self.assertAccessDependency(locations, items)
def testDart(self) -> None:
def test_dart(self) -> None:
"""locations that hard require the Rope Dart"""
locations = [
"Ninja Village Seal - Tree House", "Autumn Hills - Key of Hope", "Howling Grotto Seal - Crushing Pits",
@@ -31,7 +31,7 @@ class AccessTest(MessengerTestBase):
items = [["Rope Dart"]]
self.assertAccessDependency(locations, items)
def testWingsuit(self) -> None:
def test_wingsuit(self) -> None:
"""locations that hard require the Wingsuit"""
locations = [
"Ninja Village - Candle", "Ninja Village Seal - Tree House", "Autumn Hills - Climbing Claws",
@@ -57,7 +57,7 @@ class AccessTest(MessengerTestBase):
items = [["Wingsuit"]]
self.assertAccessDependency(locations, items)
def testVertical(self) -> None:
def test_vertical(self) -> None:
"""locations that require either the Rope Dart or the Wingsuit"""
locations = [
"Ninja Village Seal - Tree House", "Howling Grotto Seal - Crushing Pits",
@@ -92,7 +92,7 @@ class AccessTest(MessengerTestBase):
items = [["Wingsuit", "Rope Dart"]]
self.assertAccessDependency(locations, items)
def testAmulet(self) -> None:
def test_amulet(self) -> None:
"""Locations that require Ruxxtin's Amulet"""
locations = [
"Cloud Ruins - Acro", "Cloud Ruins Seal - Ghost Pit", "Cloud Ruins Seal - Toothbrush Alley",
@@ -103,7 +103,7 @@ class AccessTest(MessengerTestBase):
items = [["Ruxxtin's Amulet"]]
self.assertAccessDependency(locations, items)
def testFirefly(self) -> None:
def test_firefly(self) -> None:
"""Elemental Skylands and Corrupted Future require the Magic Firefly"""
locations = [
"Elemental Skylands - Key of Symbiosis", "Elemental Skylands Seal - Air", "Elemental Skylands Seal - Fire",
@@ -113,7 +113,7 @@ class AccessTest(MessengerTestBase):
items = [["Magic Firefly"]]
self.assertAccessDependency(locations, items)
def testCrests(self) -> None:
def test_crests(self) -> None:
"""Test Key of Love nonsense"""
locations = ["Sunken Shrine - Key of Love"]
items = [["Sun Crest", "Moon Crest"]]
@@ -124,19 +124,19 @@ class AccessTest(MessengerTestBase):
self.collect_by_name("Sun Crest")
self.assertEqual(self.can_reach_location("Sunken Shrine - Key of Love"), False)
def testThistle(self) -> None:
def test_thistle(self) -> None:
"""I'm a chuckster!"""
locations = ["Searing Crags - Key of Strength"]
items = [["Power Thistle"]]
self.assertAccessDependency(locations, items)
def testCrown(self) -> None:
def test_crown(self) -> None:
"""Crocomire but not"""
locations = ["Corrupted Future - Key of Courage"]
items = [["Demon King Crown"]]
self.assertAccessDependency(locations, items)
def testGoal(self) -> None:
def test_goal(self) -> None:
"""Test some different states to verify goal requires the correct items"""
self.collect_all_but([*NOTES, "Rescue Phantom"])
self.assertEqual(self.can_reach_location("Rescue Phantom"), False)
@@ -153,7 +153,7 @@ class ItemsAccessTest(MessengerTestBase):
"accessibility": "items",
}
def testSelfLockingItems(self) -> None:
def test_self_locking_items(self) -> None:
"""Force items that can be self locked to ensure it's valid placement."""
location_lock_pairs = {
"Searing Crags - Key of Strength": ["Power Thistle"],

View File

@@ -1,5 +1,5 @@
from . import MessengerTestBase
from ..SubClasses import MessengerLocation
from ..subclasses import MessengerLocation
class LocationsTest(MessengerTestBase):
@@ -10,7 +10,7 @@ class LocationsTest(MessengerTestBase):
@property
def run_default_tests(self) -> bool:
return False
def testLocationsExist(self):
def test_locations_exist(self) -> None:
for location in self.multiworld.worlds[1].location_name_to_id:
self.assertIsInstance(self.multiworld.get_location(location, self.player), MessengerLocation)

View File

@@ -1,5 +1,3 @@
from typing import Iterable, List
from BaseClasses import ItemClassification
from . import MessengerTestBase
@@ -10,7 +8,7 @@ class HardLogicTest(MessengerTestBase):
"shuffle_shards": "true",
}
def testVertical(self) -> None:
def test_vertical(self) -> None:
"""Test the locations that still require wingsuit or rope dart."""
locations = [
# tower of time
@@ -54,7 +52,7 @@ class HardLogicTest(MessengerTestBase):
items = [["Wingsuit", "Rope Dart"]]
self.assertAccessDependency(locations, items)
def testWindmill(self) -> None:
def test_windmill(self) -> None:
"""Windmill Shuriken isn't progression on normal difficulty, so test it's marked correctly and required."""
self.assertEqual(ItemClassification.progression, self.get_item_by_name("Windmill Shuriken").classification)
windmill_locs = [
@@ -81,8 +79,8 @@ class HardLogicTest(MessengerTestBase):
item = self.get_item_by_name("Rope Dart")
self.collect(item)
self.assertTrue(self.can_reach_location(special_loc))
def testGlacial(self) -> None:
def test_glacial(self) -> None:
"""Test Glacial Peak locations."""
self.assertAccessDependency(["Glacial Peak Seal - Ice Climbers"],
[["Second Wind", "Meditation"], ["Rope Dart"], ["Wingsuit"]],
@@ -100,7 +98,7 @@ class NoLogicTest(MessengerTestBase):
"logic_level": "oob",
}
def testAccess(self) -> None:
def test_access(self) -> None:
"""Test the locations with rules still require things."""
all_locations = [
"Bamboo Creek - Claustro", "Searing Crags - Key of Strength", "Elemental Skylands - Key of Symbiosis",

View File

@@ -1,5 +1,5 @@
from . import MessengerTestBase
from ..Constants import NOTES
from ..constants import NOTES
class TwoNoteGoalTest(MessengerTestBase):
@@ -7,7 +7,7 @@ class TwoNoteGoalTest(MessengerTestBase):
"notes_needed": 2,
}
def testPrecollectedNotes(self) -> None:
def test_precollected_notes(self) -> None:
self.assertEqual(self.multiworld.state.count_group("Notes", self.player), 4)
@@ -16,15 +16,15 @@ class FourNoteGoalTest(MessengerTestBase):
"notes_needed": 4,
}
def testPrecollectedNotes(self) -> None:
def test_precollected_notes(self) -> None:
self.assertEqual(self.multiworld.state.count_group("Notes", self.player), 2)
class DefaultGoalTest(MessengerTestBase):
def testPrecollectedNotes(self) -> None:
def test_precollected_notes(self) -> None:
self.assertEqual(self.multiworld.state.count_group("Notes", self.player), 0)
def testGoal(self) -> None:
def test_goal(self) -> None:
self.assertBeatable(False)
self.collect_by_name(NOTES)
rope_dart = self.get_item_by_name("Rope Dart")

View File

@@ -1,7 +1,7 @@
from typing import Dict
from . import MessengerTestBase
from ..Shop import SHOP_ITEMS, FIGURINES
from ..shop import SHOP_ITEMS, FIGURINES
class ShopCostTest(MessengerTestBase):
@@ -10,13 +10,13 @@ class ShopCostTest(MessengerTestBase):
"shuffle_shards": "true",
}
def testShopRules(self) -> None:
def test_shop_rules(self) -> None:
for loc in SHOP_ITEMS:
loc = f"The Shop - {loc}"
with self.subTest("has cost", loc=loc):
self.assertFalse(self.can_reach_location(loc))
def testShopPrices(self) -> None:
def test_shop_prices(self) -> None:
prices: Dict[str, int] = self.multiworld.worlds[self.player].shop_prices
for loc, price in prices.items():
with self.subTest("prices", loc=loc):
@@ -24,7 +24,7 @@ class ShopCostTest(MessengerTestBase):
self.assertTrue(loc in SHOP_ITEMS)
self.assertEqual(len(prices), len(SHOP_ITEMS))
def testDBoost(self) -> None:
def test_dboost(self) -> None:
locations = [
"Riviere Turquoise Seal - Bounces and Balls",
"Forlorn Temple - Demon King", "Forlorn Temple Seal - Rocket Maze", "Forlorn Temple Seal - Rocket Sunset",
@@ -33,10 +33,10 @@ class ShopCostTest(MessengerTestBase):
items = [["Path of Resilience", "Meditation", "Second Wind"]]
self.assertAccessDependency(locations, items)
def testCurrents(self) -> None:
def test_currents(self) -> None:
self.assertAccessDependency(["Elemental Skylands Seal - Water"], [["Currents Master"]])
def testStrike(self) -> None:
def test_strike(self) -> None:
locations = [
"Glacial Peak Seal - Projectile Spike Pit", "Elemental Skylands Seal - Fire",
]
@@ -50,22 +50,22 @@ class ShopCostMinTest(ShopCostTest):
"shuffle_seals": "false",
}
def testShopRules(self) -> None:
def test_shop_rules(self) -> None:
if self.multiworld.worlds[self.player].total_shards:
super().testShopRules()
super().test_shop_rules()
else:
for loc in SHOP_ITEMS:
loc = f"The Shop - {loc}"
with self.subTest("has cost", loc=loc):
self.assertTrue(self.can_reach_location(loc))
def testDBoost(self) -> None:
def test_dboost(self) -> None:
pass
def testCurrents(self) -> None:
def test_currents(self) -> None:
pass
def testStrike(self) -> None:
def test_strike(self) -> None:
pass
@@ -79,7 +79,7 @@ class PlandoTest(MessengerTestBase):
},
}
def testCosts(self) -> None:
def test_costs(self) -> None:
for loc in SHOP_ITEMS:
loc = f"The Shop - {loc}"
with self.subTest("has cost", loc=loc):

View File

@@ -8,11 +8,11 @@ class AllSealsRequired(MessengerTestBase):
"goal": "power_seal_hunt",
}
def testSealsShuffled(self) -> None:
def test_seals_shuffled(self) -> None:
"""Shuffle seals should be forced on when shop chest is the goal so test it."""
self.assertTrue(self.multiworld.shuffle_seals[self.player])
def testChestAccess(self) -> None:
def test_chest_access(self) -> None:
"""Defaults to a total of 45 power seals in the pool and required."""
with self.subTest("Access Dependency"):
self.assertEqual(len([seal for seal in self.multiworld.itempool if seal.name == "Power Seal"]),
@@ -38,7 +38,7 @@ class HalfSealsRequired(MessengerTestBase):
"percent_seals_required": 50,
}
def testSealsAmount(self) -> None:
def test_seals_amount(self) -> None:
"""Should have 45 power seals in the item pool and half that required"""
self.assertEqual(self.multiworld.total_seals[self.player], 45)
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 45)
@@ -57,7 +57,7 @@ class ThirtyThirtySeals(MessengerTestBase):
"percent_seals_required": 34,
}
def testSealsAmount(self) -> None:
def test_seals_amount(self) -> None:
"""Should have 30 power seals in the pool and 33 percent of that required."""
self.assertEqual(self.multiworld.total_seals[self.player], 30)
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 30)
@@ -75,7 +75,7 @@ class MaxSealsNoShards(MessengerTestBase):
"total_seals": 85,
}
def testSealsAmount(self) -> None:
def test_seals_amount(self) -> None:
"""Should set total seals to 70 since shards aren't shuffled."""
self.assertEqual(self.multiworld.total_seals[self.player], 85)
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 70)
@@ -88,7 +88,7 @@ class MaxSealsWithShards(MessengerTestBase):
"shuffle_shards": "true",
}
def testSealsAmount(self) -> None:
def test_seals_amount(self) -> None:
"""Should have 85 seals in the pool with all required and be a valid seed."""
self.assertEqual(self.multiworld.total_seals[self.player], 85)
self.assertEqual(self.multiworld.worlds[self.player].total_seals, 85)