Skip to content

Commit de0fed3

Browse files
committed
ArchipelagoMW#2143: switch from SpecialRange to NamedRange
1 parent 000c1b2 commit de0fed3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

WebHostLib/options.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def get_html_doc(option_type: type(Options.Option)) -> str:
133133
continue
134134

135135
option = world.options_dataclass.type_hints[option_name].from_any(option_value)
136-
if isinstance(option, Options.SpecialRange) and isinstance(option_value, str):
136+
if isinstance(option, Options.NamedRange) and isinstance(option_value, str):
137137
assert option_value in option.special_range_names, \
138138
f"Invalid preset value '{option_value}' for '{option_name}' in '{preset_name}'. " \
139139
f"Expected {option.special_range_names.keys()} or {option.range_start}-{option.range_end}."

docs/world api.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ the options and the values are the values to be set for that option. These prese
7979

8080
Note: The values must be a non-aliased value for the option type and can only include the following option types:
8181

82-
- If you have a `Range`/`SpecialRange` option, the value should be an `int` between the `range_start` and `range_end`
82+
- If you have a `Range`/`NamedRange` option, the value should be an `int` between the `range_start` and `range_end`
8383
values.
84-
- If you have a `SpecialRange` option, the value can alternatively be a `str` that is one of the
84+
- If you have a `NamedRange` option, the value can alternatively be a `str` that is one of the
8585
`special_range_names` keys.
8686
- If you have a `Choice` option, the value should be a `str` that is one of the `option_<name>` values.
8787
- If you have a `Toggle`/`DefaultOnToggle` option, the value should be a `bool`.

test/webhost/test_option_presets.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import unittest
22

33
from worlds import AutoWorldRegister
4-
from Options import Choice, SpecialRange, Toggle, Range
4+
from Options import Choice, NamedRange, Toggle, Range
55

66

77
class TestOptionPresets(unittest.TestCase):
@@ -14,7 +14,7 @@ def test_option_presets_have_valid_options(self):
1414
with self.subTest(game=game_name, preset=preset_name, option=option_name):
1515
try:
1616
option = world_type.options_dataclass.type_hints[option_name].from_any(option_value)
17-
supported_types = [Choice, Toggle, Range, SpecialRange]
17+
supported_types = [Choice, Toggle, Range, NamedRange]
1818
if not any([issubclass(option.__class__, t) for t in supported_types]):
1919
self.fail(f"'{option_name}' in preset '{preset_name}' for game '{game_name}' "
2020
f"is not a supported type for webhost. "
@@ -46,8 +46,8 @@ def test_option_preset_values_are_explicitly_defined(self):
4646

4747
# Check for from_text resolving to a different value. ("random" is allowed though.)
4848
if option_value != "random" and isinstance(option_value, str):
49-
# Allow special named values for SpecialRange option presets.
50-
if isinstance(option, SpecialRange):
49+
# Allow special named values for NamedRange option presets.
50+
if isinstance(option, NamedRange):
5151
self.assertTrue(
5252
option_value in option.special_range_names,
5353
f"Invalid preset '{option_name}': '{option_value}' in preset '{preset_name}' "

0 commit comments

Comments
 (0)