Пример #1
0
    def test_new_configuration_setting(self):

        class Test(object):
            generating = ConfigurationSetting()

            @ConfigurationSetting(name='required_fields')
            def some_name__other_than_required_fields(self):
                pass

            @some_name__other_than_required_fields.setter
            def some_name__other_than_required_fields(self, value):
                pass

            @ConfigurationSetting
            def streaming_preop(self):
                pass

            @streaming_preop.setter
            def streaming_preop(self, value):
                pass

        ConfigurationSetting.fix_up(Test, {})

        test = Test()
        self.assertFalse(hasattr(Test, '_generating'))
        self.assertFalse(hasattr(test, '_generating'))
        self.assertIsNone(test.generating)

        Test._generating = True
        self.assertIs(test.generating, True)

        test.generating = False
        self.assertIs(test.generating, False)
        self.assertIs(Test._generating, True)
        self.assertIs(test._generating, False)

        self.assertRaises(ValueError, Test.generating.fset, test, 'any type other than bool')
Пример #2
0
        class Test(object):
            generating = ConfigurationSetting()

            @ConfigurationSetting(name='required_fields')
            def some_name__other_than_required_fields(self):
                pass

            @some_name__other_than_required_fields.setter
            def some_name__other_than_required_fields(self, value):
                pass

            @ConfigurationSetting
            def streaming_preop(self):
                pass

            @streaming_preop.setter
            def streaming_preop(self, value):
                pass
Пример #3
0
                class ConfigurationSettings(SearchCommand.ConfigurationSettings):
                    clear_required_fields = ConfigurationSetting()
                    distributed = ConfigurationSetting()
                    generates_timeorder = ConfigurationSetting()
                    generating = ConfigurationSetting()
                    maxinputs = ConfigurationSetting()
                    overrides_timeorder = ConfigurationSetting()
                    required_fields = ConfigurationSetting()
                    requires_preop = ConfigurationSetting()
                    retainsevents = ConfigurationSetting()
                    run_in_preview = ConfigurationSetting()
                    streaming = ConfigurationSetting()
                    streaming_preop = ConfigurationSetting()
                    type = ConfigurationSetting()

                    @classmethod
                    def fix_up(cls, command_class):
                        return
Пример #4
0
    class ConfigurationSettings(SearchCommand.ConfigurationSettings):

        # region SCP v1/v2 properties

        generating = ConfigurationSetting()
        required_fields = ConfigurationSetting()
        streaming_preop = ConfigurationSetting()

        # endregion

        # region SCP v1 properties

        clear_required_fields = ConfigurationSetting()
        generates_timeorder = ConfigurationSetting()
        overrides_timeorder = ConfigurationSetting()
        requires_preop = ConfigurationSetting()
        retainsevents = ConfigurationSetting()
        streaming = ConfigurationSetting()

        # endregion

        # region SCP v2 properties

        distributed = ConfigurationSetting()
        maxinputs = ConfigurationSetting()
        run_in_preview = ConfigurationSetting()
        type = ConfigurationSetting()