示例#1
0
 class MyConfig(self.CONFIG_TYPE):
     lucky_numbers = DictOption('LuckyNumber',
                                IntOption('_'),
                                default={
                                    'a': 1,
                                    'b': 2,
                                    'c': 3
                                },
                                allow_cache=True)
示例#2
0
 class MyConfig(self.CONFIG_TYPE):
     lucky_number = IntOption('LuckyNumber', default=42)
示例#3
0
 class MyConfig(self.CONFIG_TYPE):
     lucky_numbers = DictOption('LuckyNumber', IntOption('_'))
示例#4
0
 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)
示例#5
0
 def test_choices_cannot_be_empty(self):
     c = MyConfig.get_instance()
     with self.assertRaises(InitializationError):
         c.empty_choices = IntOption('EmptyChoices', choices=[], default=1)
示例#6
0
 class Diameters(DummyMemoryConfig):
     lamp_cap_diameter = IntOption('LampCapDiameter',
                                   choices=[14, 27],
                                   env_name='LAMP_CAP_DIAMETER',
                                   default=27)
示例#7
0
class MyConfig(DummyMemoryConfig):
    fortytwo = IntOption('FortyTwo', env_name='FORTY_TWO', default=42)
    age = IntOption('Age', default=0)
示例#8
0
 class MyConfig(self.CONFIG_TYPE):
     second_name = StringOption('SecondName', default='Kulakov')
     age = IntOption('Age', default=42)
     first_name = StringOption('FirstName', default='Ilya')
示例#9
0
 class MyConfig(self.CONFIG_TYPE):
     age = IntOption('Age', default=42)
示例#10
0
 class MyConfig(self.CONFIG_TYPE):
     lucky_numbers = ArrayOption('LuckyNumber',
                                 IntOption('_'),
                                 default=(1, 2, 3),
                                 allow_cache=True)
示例#11
0
 class MyConfig(self.CONFIG_TYPE):
     lucky_numbers = DictOption('LuckyNumber',
                                IntOption('_'),
                                allow_cache=True)
示例#12
0
 class MyConfig2(MyConfig):
     first_name = IntOption('FirstName', default=42)
示例#13
0
 class MyConfig(self.CONFIG_TYPE, MyConfigMixin1, MyConfigMixin2):
     age = IntOption('Age', default=42)
示例#14
0
        class MyConfig(self.CONFIG_TYPE):
            lucky_number = IntOption('LuckyNumber', default=42)

            @property
            def custom_property(self):
                return '9000'
示例#15
0
 class MyConfigMixin:
     age = IntOption('Age', default=42)
示例#16
0
 class MyConfig(self.CONFIG_TYPE):
     lucky_number = IntOption('LuckyNumber', default=42)
     first_name = StringOption('FirstName')
     last_name = StringOption('LastName')
示例#17
0
 class SubMyConfig(MyConfig):
     lucky_number = IntOption('LuckyNumber', default=9000)
示例#18
0
 class MyConfig(MemoryConfig):
     age = IntOption('Age', default=42)