diff --git a/.github/pyright-config.json b/.github/pyright-config.json index 6ad7fa5f19b5..3064332951a9 100644 --- a/.github/pyright-config.json +++ b/.github/pyright-config.json @@ -1,8 +1,20 @@ { "include": [ - "type_check.py", + "../BizHawkClient.py", + "../Patch.py", + "../test/general/test_groups.py", + "../test/general/test_helpers.py", + "../test/general/test_memory.py", + "../test/general/test_names.py", + "../test/multiworld/__init__.py", + "../test/multiworld/test_multiworlds.py", + "../test/netutils/__init__.py", + "../test/programs/__init__.py", + "../test/programs/test_multi_server.py", + "../test/utils/__init__.py", + "../test/webhost/test_descriptions.py", "../worlds/AutoSNIClient.py", - "../Patch.py" + "type_check.py" ], "exclude": [ diff --git a/.github/workflows/strict-type-check.yml b/.github/workflows/strict-type-check.yml index bafd572a26ae..91f4aed92a2d 100644 --- a/.github/workflows/strict-type-check.yml +++ b/.github/workflows/strict-type-check.yml @@ -26,7 +26,7 @@ jobs: - name: "Install dependencies" run: | - python -m pip install --upgrade pip pyright==1.1.358 + python -m pip install --upgrade pip pyright==1.1.377 python ModuleUpdate.py --append "WebHostLib/requirements.txt" --force --yes - name: "pyright: strict check on specific files" diff --git a/test/general/test_helpers.py b/test/general/test_helpers.py index be8473975638..7e850f9744c5 100644 --- a/test/general/test_helpers.py +++ b/test/general/test_helpers.py @@ -1,6 +1,8 @@ import unittest from typing import Callable, Dict, Optional +from typing_extensions import override + from BaseClasses import CollectionState, MultiWorld, Region @@ -8,6 +10,7 @@ class TestHelpers(unittest.TestCase): multiworld: MultiWorld player: int = 1 + @override def setUp(self) -> None: self.multiworld = MultiWorld(self.player) self.multiworld.game[self.player] = "helper_test_game" @@ -38,15 +41,15 @@ def test_region_helpers(self) -> None: "TestRegion1": {"TestRegion2": "connection"}, "TestRegion2": {"TestRegion1": None}, } - + reg_exit_set: Dict[str, set[str]] = { "TestRegion1": {"TestRegion3"} } - + exit_rules: Dict[str, Callable[[CollectionState], bool]] = { "TestRegion1": lambda state: state.has("test_item", self.player) } - + self.multiworld.regions += [Region(region, self.player, self.multiworld, regions[region]) for region in regions] with self.subTest("Test Location Creation Helper"): @@ -73,7 +76,7 @@ def test_region_helpers(self) -> None: entrance_name = exit_name if exit_name else f"{parent} -> {exit_reg}" self.assertEqual(exit_rules[exit_reg], self.multiworld.get_entrance(entrance_name, self.player).access_rule) - + for region in reg_exit_set: current_region = self.multiworld.get_region(region, self.player) current_region.add_exits(reg_exit_set[region]) diff --git a/test/general/test_memory.py b/test/general/test_memory.py index e352b9e8751a..987d19acf35f 100644 --- a/test/general/test_memory.py +++ b/test/general/test_memory.py @@ -5,7 +5,7 @@ class TestWorldMemory(unittest.TestCase): - def test_leak(self): + def test_leak(self) -> None: """Tests that worlds don't leak references to MultiWorld or themselves with default options.""" import gc import weakref diff --git a/test/general/test_names.py b/test/general/test_names.py index 7be76eed4ba9..8ad74a33544d 100644 --- a/test/general/test_names.py +++ b/test/general/test_names.py @@ -3,7 +3,7 @@ class TestNames(unittest.TestCase): - def test_item_names_format(self): + def test_item_names_format(self) -> None: """Item names must not be all numeric in order to differentiate between ID and name in !hint""" for gamename, world_type in AutoWorldRegister.world_types.items(): with self.subTest(game=gamename): @@ -11,7 +11,7 @@ def test_item_names_format(self): self.assertFalse(item_name.isnumeric(), f"Item name \"{item_name}\" is invalid. It must not be numeric.") - def test_location_name_format(self): + def test_location_name_format(self) -> None: """Location names must not be all numeric in order to differentiate between ID and name in !hint_location""" for gamename, world_type in AutoWorldRegister.world_types.items(): with self.subTest(game=gamename):