class MyConfig(self.CONFIG_TYPE): lucky_numbers = DictOption('LuckyNumber', IntOption('_'), default={ 'a': 1, 'b': 2, 'c': 3 }, allow_cache=True)
class MyConfig(self.CONFIG_TYPE): lucky_number = IntOption('LuckyNumber', default=42)
class MyConfig(self.CONFIG_TYPE): lucky_numbers = DictOption('LuckyNumber', IntOption('_'))
def test_default_value_must_be_one_of_choices_if_any(self): c = MyConfig.get_instance() with self.assertRaises(ValidationError): c.lamp_cap_diameter = IntOption('LampCapDiameter', choices=[14, 27], default=42)
def test_choices_cannot_be_empty(self): c = MyConfig.get_instance() with self.assertRaises(InitializationError): c.empty_choices = IntOption('EmptyChoices', choices=[], default=1)
class Diameters(DummyMemoryConfig): lamp_cap_diameter = IntOption('LampCapDiameter', choices=[14, 27], env_name='LAMP_CAP_DIAMETER', default=27)
class MyConfig(DummyMemoryConfig): fortytwo = IntOption('FortyTwo', env_name='FORTY_TWO', default=42) age = IntOption('Age', default=0)
class MyConfig(self.CONFIG_TYPE): second_name = StringOption('SecondName', default='Kulakov') age = IntOption('Age', default=42) first_name = StringOption('FirstName', default='Ilya')
class MyConfig(self.CONFIG_TYPE): age = IntOption('Age', default=42)
class MyConfig(self.CONFIG_TYPE): lucky_numbers = ArrayOption('LuckyNumber', IntOption('_'), default=(1, 2, 3), allow_cache=True)
class MyConfig(self.CONFIG_TYPE): lucky_numbers = DictOption('LuckyNumber', IntOption('_'), allow_cache=True)
class MyConfig2(MyConfig): first_name = IntOption('FirstName', default=42)
class MyConfig(self.CONFIG_TYPE, MyConfigMixin1, MyConfigMixin2): age = IntOption('Age', default=42)
class MyConfig(self.CONFIG_TYPE): lucky_number = IntOption('LuckyNumber', default=42) @property def custom_property(self): return '9000'
class MyConfigMixin: age = IntOption('Age', default=42)
class MyConfig(self.CONFIG_TYPE): lucky_number = IntOption('LuckyNumber', default=42) first_name = StringOption('FirstName') last_name = StringOption('LastName')
class SubMyConfig(MyConfig): lucky_number = IntOption('LuckyNumber', default=9000)
class MyConfig(MemoryConfig): age = IntOption('Age', default=42)