Test Bases

class test.bases.TestBase(methodName='runTest')

Bases: TestCase

get_path(state, region)
get_state(items)
multiworld: MultiWorld
run_entrance_tests(access_pool)
run_location_tests(access_pool)
class test.bases.WorldTestBase(methodName='runTest')

Bases: TestCase

assertAccessDependency(locations: List[str], possible_items: Iterable[Iterable[str]], only_check_listed: bool = False) None

Asserts that the provided locations can’t be reached without the listed items but can be reached with any one of the provided combinations

assertBeatable(beatable: bool)

Asserts that the game can be beaten with the current state

auto_construct: ClassVar[bool] = True

automatically set up a world for each test in this class

can_reach_entrance(entrance: str) bool

Determines if the current state can reach the provided entrance name

can_reach_location(location: str) bool

Determines if the current state can reach the provided location name

can_reach_region(region: str) bool

Determines if the current state can reach the provided region name

collect(items: Item | Iterable[Item]) None

Collects the provided item(s) into state

collect_all_but(item_names: str | Iterable[str], state: CollectionState | None = None) None

Collects all pre-placed items and items in the multiworld itempool except those provided

collect_by_name(item_names: str | Iterable[str]) List[Item]

collect all of the items in the item pool that have the given names

property constructed: bool

A multiworld has been constructed by this point

count(item_name: str) int

Returns the amount of an item currently in state

game: ClassVar[str]

Define game name in subclass, example “Secret of Evermore”.

get_item_by_name(item_name: str) Item

Returns the first item found in placed items, or in the itempool with the matching name

get_items_by_name(item_names: str | Iterable[str]) List[Item]

Returns actual items from the itempool that match the provided name(s)

memory_leak_tested: ClassVar[bool] = False

remember if memory leak test was already done for this class

multiworld: MultiWorld

The constructed MultiWorld instance after setup.

options: Dict[str, Any] = {}

Define options that should be used when setting up this TestBase.

player: ClassVar[int] = 1
remove(items: Item | Iterable[Item]) None

Removes the provided item(s) from state

remove_by_name(item_names: str | Iterable[str]) List[Item]

Remove all of the items in the item pool with the given names from state

property run_default_tests: bool

Not possible or identical to the base test that’s always being run already

setUp() None

Hook method for setting up the test fixture before exercising it.

tearDown() None

Hook method for deconstructing the test fixture after testing it.

test_all_state_can_reach_everything()

Ensure all state can reach everything and complete the game with the defined options

test_empty_state_can_reach_something()

Ensure empty state can reach at least one location with the defined options

test_fill()

Generates a multiworld and validates placements with the defined options

world: World

The constructed World instance after setup.

world_setup(seed: int | None = None) None