Skip to content

Commit

Permalink
Also add validation to the NamedRange class itself
Browse files Browse the repository at this point in the history
  • Loading branch information
NewSoupVi authored Jun 13, 2024
1 parent 0396559 commit e22eea0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,11 @@ def __init__(self, value: int) -> None:
elif value > self.range_end and value not in self.special_range_names.values():
raise Exception(f"{value} is higher than maximum {self.range_end} for option {self.__class__.__name__} " +
f"and is also not one of the supported named special values: {self.special_range_names}")

for key in self.special_range_names:
if key != key.lower() or " " in key:
raise Exception(f"{self.__class__.__name__} has an invalid special_range_names key: {key}. "
f"NamedRange keys must use only lowercase letters and underscores.")
self.value = value

@classmethod
Expand Down

0 comments on commit e22eea0

Please sign in to comment.