def set(self, name, value): """Sets a single setting. :param name: Setting name :param value: Setting value; must be JSON-serializable """ self._check_name(name) Setting.set(self.module, name, self._convert_from_python(name, value)) self._flush_cache()
def set(self, name, value): """Set a single setting. :param name: Setting name :param value: Setting value; must be JSON-serializable """ self._check_name(name) Setting.set(self.module, name, self._convert_from_python(name, value)) self._flush_cache()
def test_set_enum(): class Useless(int, Enum): thing = 1337 Setting.set_multi('foo', {'foo': Useless.thing}) Setting.set('foo', 'bar', Useless.thing) for key in {'foo', 'bar'}: value = Setting.get('foo', key) assert value == Useless.thing assert value == Useless.thing.value assert not isinstance(value, Useless) # we store it as a plain value!