From d9120f0bea7fb564c51d3257e2ed67624d73261f Mon Sep 17 00:00:00 2001 From: Exempt-Medic <60412657+Exempt-Medic@users.noreply.github.com> Date: Mon, 3 Jun 2024 04:42:27 -0400 Subject: [PATCH] WebHost: Allowing options that work on WebHost to be used in presets (#3441) --- WebHostLib/options.py | 2 +- test/webhost/test_option_presets.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WebHostLib/options.py b/WebHostLib/options.py index 62ba86a5..53c3a615 100644 --- a/WebHostLib/options.py +++ b/WebHostLib/options.py @@ -91,7 +91,7 @@ def option_presets(game: str) -> Response: f"Expected {option.special_range_names.keys()} or {option.range_start}-{option.range_end}." presets[preset_name][preset_option_name] = option.value - elif isinstance(option, Options.Range): + elif isinstance(option, (Options.Range, Options.OptionSet, Options.OptionList, Options.ItemDict)): presets[preset_name][preset_option_name] = option.value elif isinstance(preset_option, str): # Ensure the option value is valid for Choice and Toggle options diff --git a/test/webhost/test_option_presets.py b/test/webhost/test_option_presets.py index 0c88b6c2..b0af8a87 100644 --- a/test/webhost/test_option_presets.py +++ b/test/webhost/test_option_presets.py @@ -1,7 +1,7 @@ import unittest from worlds import AutoWorldRegister -from Options import Choice, NamedRange, Toggle, Range +from Options import ItemDict, NamedRange, NumericOption, OptionList, OptionSet class TestOptionPresets(unittest.TestCase): @@ -14,7 +14,7 @@ class TestOptionPresets(unittest.TestCase): 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) - supported_types = [Choice, Toggle, Range, NamedRange] + 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}' " f"is not a supported type for webhost. "