def validate(self) -> None: """ Validate the configuration against the core. """ valid_keys = core.get_keys() valid_mods = core.get_modifiers() # we explicitly do not want to set self.keys and self.mouse above, # because they are dynamically resolved from the default_config. so we # need to ignore the errors here about missing attributes. for k in self.keys: # type: ignore if k.key not in valid_keys: raise ConfigError("No such key: %s" % k.key) for m in k.modifiers: if m not in valid_mods: raise ConfigError("No such modifier: %s" % m) for ms in self.mouse: # type: ignore for m in ms.modifiers: if m not in valid_mods: raise ConfigError("No such modifier: %s" % m)
def test_keys(display): assert "a" in core.get_keys() assert "shift" in core.get_modifiers()