コード例 #1
0
ファイル: test_config.py プロジェクト: lrbsunday/drove
    def test_config_hierarchy(self):
        """Testing Config: hierarchy"""
        c = Config()
        c["value"] = "lowlevel"
        c["plugin.one.value"] = "value"
        c["plugin.one.othervalue"] = "other"
        c["plugin.two"] = "second"

        assert c.get_childs("plugin") == {"one", "two"}
        assert c.get_childs("plugin.one") == {"value", "othervalue"}
        assert c.get("plugin.one.value") == "value"
        assert c.get("plugin.two.value") == "lowlevel"
コード例 #2
0
ファイル: test_config.py プロジェクト: lrbsunday/drove
    def test_config_hierarchy(self):
        """Testing Config: hierarchy"""
        c = Config()
        c["value"] = "lowlevel"
        c["plugin.one.value"] = "value"
        c["plugin.one.othervalue"] = "other"
        c["plugin.two"] = "second"

        assert c.get_childs("plugin") == {"one", "two"}
        assert c.get_childs("plugin.one") == {"value", "othervalue"}
        assert c.get("plugin.one.value") == "value"
        assert c.get("plugin.two.value") == "lowlevel"
コード例 #3
0
ファイル: test_config.py プロジェクト: lrbsunday/drove
 def test_config_notfound(self):
     """Testing Config: value not found"""
     c = Config()
     with self.assertRaises(ConfigError):
         c.get("notfound")
コード例 #4
0
ファイル: test_config.py プロジェクト: lrbsunday/drove
 def test_config_default(self):
     """Testing Config: get with default"""
     c = Config()
     assert c.get("none", "value") == "value"
コード例 #5
0
ファイル: test_config.py プロジェクト: lrbsunday/drove
 def test_config_include(self):
     """Testing Config: include"""
     c = Config(os.devnull)
     c["include"] = self.config_file
     c.reload()
     assert c.get("plugin_dir", False)
コード例 #6
0
ファイル: test_config.py プロジェクト: lrbsunday/drove
 def test_config_notfound(self):
     """Testing Config: value not found"""
     c = Config()
     with self.assertRaises(ConfigError):
         c.get("notfound")
コード例 #7
0
ファイル: test_config.py プロジェクト: lrbsunday/drove
 def test_config_default(self):
     """Testing Config: get with default"""
     c = Config()
     assert c.get("none", "value") == "value"
コード例 #8
0
ファイル: test_config.py プロジェクト: lrbsunday/drove
 def test_config_include(self):
     """Testing Config: include"""
     c = Config(os.devnull)
     c["include"] = self.config_file
     c.reload()
     assert c.get("plugin_dir", False)