예제 #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)