From e22eea056dcdf466fe6c4542d3a756a52e1fb549 Mon Sep 17 00:00:00 2001 From: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com> Date: Thu, 13 Jun 2024 18:08:28 +0200 Subject: [PATCH] Also add validation to the NamedRange class itself --- Options.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Options.py b/Options.py index 40a6996d32..83b6a4162a 100644 --- a/Options.py +++ b/Options.py @@ -735,6 +735,11 @@ class NamedRange(Range): 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