Tests: Don't use type as Callable (#4866)

This commit is contained in:
Doug Hoskisson
2025-04-20 04:21:40 -07:00
committed by GitHub
parent a26abe079e
commit e498cc7d48

View File

@@ -1,3 +1,4 @@
from typing import Callable
import unittest
from enum import IntEnum
@@ -34,7 +35,7 @@ def generate_entrance_pair(region: Region, name_suffix: str, group: int):
def generate_disconnected_region_grid(multiworld: MultiWorld, grid_side_length: int, region_size: int = 0,
region_type: type[Region] = Region):
region_creator: Callable[[str, int, MultiWorld], Region] = Region):
"""
Generates a grid-like region structure for ER testing, where menu is connected to the top-left region, and each
region "in vanilla" has 2 2-way exits going either down or to the right, until reaching the goal region in the
@@ -44,7 +45,7 @@ def generate_disconnected_region_grid(multiworld: MultiWorld, grid_side_length:
for col in range(grid_side_length):
index = row * grid_side_length + col
name = f"region{index}"
region = region_type(name, 1, multiworld)
region = region_creator(name, 1, multiworld)
multiworld.regions.append(region)
generate_locations(region_size, 1, region=region, tag=f"_{name}")
@@ -465,7 +466,7 @@ class TestRandomizeEntrances(unittest.TestCase):
entrance_type = CustomEntrance
multiworld = generate_test_multiworld()
generate_disconnected_region_grid(multiworld, 5, region_type=CustomRegion)
generate_disconnected_region_grid(multiworld, 5, region_creator=CustomRegion)
self.assertRaises(EntranceRandomizationError, randomize_entrances, multiworld.worlds[1], False,
directionally_matched_group_lookup)