Skip to content

Commit

Permalink
Tests: have option preset validation test do full validation
Browse files Browse the repository at this point in the history
  • Loading branch information
alwaysintreble committed Nov 18, 2024
1 parent 4b80b78 commit d68607a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/webhost/test_option_presets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest

from BaseClasses import PlandoOptions
from worlds import AutoWorldRegister
from Options import ItemDict, NamedRange, NumericOption, OptionList, OptionSet

Expand All @@ -14,6 +15,10 @@ def test_option_presets_have_valid_options(self):
with self.subTest(game=game_name, preset=preset_name, option=option_name):
try:
option = world_type.options_dataclass.type_hints[option_name].from_any(option_value)
# some options may need verification to ensure the provided option is actually valid
# pass in all plando options in case a preset wants to require certain plando options
# for some reason
option.verify(world_type, "Test Player", PlandoOptions(0b1111))
supported_types = [NumericOption, OptionSet, OptionList, ItemDict]
if not any([issubclass(option.__class__, t) for t in supported_types]):
self.fail(f"'{option_name}' in preset '{preset_name}' for game '{game_name}' "
Expand Down

0 comments on commit d68607a

Please sign in to comment.