當前位置: 首頁>>代碼示例>>Python>>正文


Python Config.adapters方法代碼示例

本文整理匯總了Python中etcaetera.config.Config.adapters方法的典型用法代碼示例。如果您正苦於以下問題:Python Config.adapters方法的具體用法?Python Config.adapters怎麽用?Python Config.adapters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在etcaetera.config.Config的用法示例。


在下文中一共展示了Config.adapters方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_adapters_setter_raises_if_overrides_is_not_last

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_adapters_setter_raises_if_overrides_is_not_last(self):
        overrides_adapter = Overrides({"abc": "123"})
        env_adapter = Env()
        config = Config()

        with pytest.raises(ValueError):
            # overrides_adapter should always be last 
            config.adapters = [overrides_adapter, env_adapter]
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:10,代碼來源:test_config.py

示例2: test_adapters_setter_raises_if_defaults_is_not_first

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_adapters_setter_raises_if_defaults_is_not_first(self):
        defaults_adapter = Defaults({"abc": "123"})
        env_adapter = Env()
        config = Config()

        with pytest.raises(ValueError):
            # defaults_adapter should always be first
            config.adapters = [env_adapter, defaults_adapter]
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:10,代碼來源:test_config.py

示例3: test_register_a_second_defaults_overrides_existing_one

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_a_second_defaults_overrides_existing_one(self):
        env_adapter = Env()
        defaults_adapter = Defaults({"abc": "123"})
        config = Config()
        config.adapters = [defaults_adapter, env_adapter]

        new_defaults = Defaults({"easy as": "do re mi"})
        config.register(new_defaults)
        assert config.defaults == new_defaults
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:11,代碼來源:test_config.py

示例4: test_register_sets_defaults_adapter_as_first_with_empty_adapters

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_sets_defaults_adapter_as_first_with_empty_adapters(self):
        defaults_adapter = Defaults({"abc": "123"})
        config = Config()

        config.adapters = []
        config.register(defaults_adapter)

        assert len(config.adapters) == 1
        assert config.adapters[0] == defaults_adapter
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:11,代碼來源:test_config.py

示例5: test_register_a_second_overrides_replaces_existing_one

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_a_second_overrides_replaces_existing_one(self):
        env_adapter = Env()
        overrides_adapter = Overrides({"abc": "123"})
        config = Config()
        config.adapters = [env_adapter, overrides_adapter]

        new_overrides = Overrides({"easy as": "do re mi"})
        config.register(new_overrides)
        assert config.overrides == new_overrides
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:11,代碼來源:test_config.py

示例6: test_register_sets_overrides_adapter_as_last_with_empty_adapters

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_sets_overrides_adapter_as_last_with_empty_adapters(self):
        overrides_adapter = Overrides({"abc": "123"})
        config = Config()

        config.adapters = []
        config.register(overrides_adapter)

        assert len(config.adapters) == 1
        assert config.adapters[0] == overrides_adapter 
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:11,代碼來源:test_config.py

示例7: test_register_a_second_defaults_raises

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_a_second_defaults_raises(self):
        env_adapter = Env()
        defaults_adapter = Defaults({"abc": "123"})
        config = Config()

        config.adapters = [defaults_adapter, env_adapter]

        with pytest.raises(ValueError):
            config.register(defaults_adapter)
開發者ID:alixz,項目名稱:etcaetera,代碼行數:11,代碼來源:test_config.py

示例8: test_register_sets_defaults_adapter_as_first_with_existing_adapters

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_sets_defaults_adapter_as_first_with_existing_adapters(self):
        env_adapter = Env()
        defaults_adapter = Defaults({"abc": "123"})
        config = Config()

        config.adapters = [env_adapter]
        config.register(defaults_adapter)

        assert config.adapters[0] == defaults_adapter
        assert config.adapters[1] == env_adapter
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:12,代碼來源:test_config.py

示例9: test_register_sets_overrides_adapter_as_last_with_existing_adapters

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_sets_overrides_adapter_as_last_with_existing_adapters(self):
        env_adapter = Env()
        overrides_adapter = Overrides({"abc": "123"})
        config = Config()

        config.adapters = [env_adapter]
        config.register(overrides_adapter)

        assert config.adapters[0] == env_adapter
        assert config.adapters[1] == overrides_adapter 
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:12,代碼來源:test_config.py

示例10: test_register_a_second_overrides_raises

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_a_second_overrides_raises(self):
        env_adapter = Env()
        overrides_adapter = Overrides({"abc": "123"})
        config = Config()

        config.adapters = [env_adapter]
        config.register(overrides_adapter)

        with pytest.raises(ValueError):
            config.register(overrides_adapter)
開發者ID:alixz,項目名稱:etcaetera,代碼行數:12,代碼來源:test_config.py

示例11: test_register_non_special_adapters_with_overrides

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_register_non_special_adapters_with_overrides(self):
        env_adapter = Env()
        file_adapter = File('/tmp/test')
        overrides_adapter = Overrides()

        config = Config()
        config.adapters = [overrides_adapter]

        config.register(env_adapter)
        config.register(file_adapter)

        assert len(config.adapters) == 3
        assert config.adapters[0] == env_adapter
        assert config.adapters[1] == file_adapter
        assert config.adapters[2] == overrides_adapter
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:17,代碼來源:test_config.py

示例12: test_adapters_setter_raises_if_a_member_has_invalid_type

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_adapters_setter_raises_if_a_member_has_invalid_type(self):
        config = Config()

        with pytest.raises(TypeError):
            config.adapters = [Env(), "abc 123"]
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:7,代碼來源:test_config.py

示例13: test_adapters_setter_raises_with_invalid_type

# 需要導入模塊: from etcaetera.config import Config [as 別名]
# 或者: from etcaetera.config.Config import adapters [as 別名]
    def test_adapters_setter_raises_with_invalid_type(self):
        config = Config()

        with pytest.raises(TypeError):
            config.adapters = "abc 123"
開發者ID:ramnes,項目名稱:etcaetera,代碼行數:7,代碼來源:test_config.py


注:本文中的etcaetera.config.Config.adapters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。