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


Python Configuration.section方法代碼示例

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


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

示例1: test_subsection_contains

# 需要導入模塊: from rubick.config_model import Configuration [as 別名]
# 或者: from rubick.config_model.Configuration import section [as 別名]
    def test_subsection_contains(self):
        c = Configuration()

        c.set('section1.param1', '123')
        c.set_default('section2.param2', '234')

        self.assertTrue('param1' in c.section('section1'))
        self.assertTrue('param2' in c.section('section2'))
        self.assertFalse('param1' in c.section('section2'))
開發者ID:plomakin,項目名稱:rubick,代碼行數:11,代碼來源:test_configuration.py

示例2: test_subsection_getitem

# 需要導入模塊: from rubick.config_model import Configuration [as 別名]
# 或者: from rubick.config_model.Configuration import section [as 別名]
    def test_subsection_getitem(self):
        c = Configuration()
        c.set(self.fullparam, self.value)

        cs = c.section(self.section)

        self.assertEqual(self.value, cs[self.param])
開發者ID:plomakin,項目名稱:rubick,代碼行數:9,代碼來源:test_configuration.py

示例3: test_subsection_keys

# 需要導入模塊: from rubick.config_model import Configuration [as 別名]
# 或者: from rubick.config_model.Configuration import section [as 別名]
    def test_subsection_keys(self):
        c = Configuration()
        c.set_default('%s.param1' % self.section, '123')
        c.set('%s.param2' % self.section, '456')

        self.assertEqual(
            ['param1', 'param2'], sorted(c.section(self.section).keys()))
開發者ID:plomakin,項目名稱:rubick,代碼行數:9,代碼來源:test_configuration.py

示例4: test_subsection_setitem

# 需要導入模塊: from rubick.config_model import Configuration [as 別名]
# 或者: from rubick.config_model.Configuration import section [as 別名]
    def test_subsection_setitem(self):
        c = Configuration()

        cs = c.section(self.section)

        cs[self.param] = self.value

        self.assertEqual(self.value, c.get(self.fullparam))
開發者ID:plomakin,項目名稱:rubick,代碼行數:10,代碼來源:test_configuration.py

示例5: test_subsection_items

# 需要導入模塊: from rubick.config_model import Configuration [as 別名]
# 或者: from rubick.config_model.Configuration import section [as 別名]
    def test_subsection_items(self):
        c = Configuration()
        c.set('%s.param1' % self.section, 'value1')
        c.set_default('%s.param2' % self.section, 'value2')

        self.assertEqual(
            [('param1', 'value1'), ('param2', 'value2')],
            sorted(c.section(self.section).items()))
開發者ID:plomakin,項目名稱:rubick,代碼行數:10,代碼來源:test_configuration.py

示例6: test_subsection_set

# 需要導入模塊: from rubick.config_model import Configuration [as 別名]
# 或者: from rubick.config_model.Configuration import section [as 別名]
    def test_subsection_set(self):
        c = Configuration()
        c.section(self.section).set(self.param, self.value)

        self.assertEqual(self.value, c.get(self.fullparam))
開發者ID:plomakin,項目名稱:rubick,代碼行數:7,代碼來源:test_configuration.py

示例7: test_returns_section_object_even_if_section_doesnot_exist

# 需要導入模塊: from rubick.config_model import Configuration [as 別名]
# 或者: from rubick.config_model.Configuration import section [as 別名]
 def test_returns_section_object_even_if_section_doesnot_exist(self):
     c = Configuration()
     self.assertIsNotNone(c.section('foo'))
開發者ID:plomakin,項目名稱:rubick,代碼行數:5,代碼來源:test_configuration.py


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