当前位置: 首页>>代码示例>>Python>>正文


Python Conf.get_lower方法代码示例

本文整理汇总了Python中galicaster.core.conf.Conf.get_lower方法的典型用法代码示例。如果您正苦于以下问题:Python Conf.get_lower方法的具体用法?Python Conf.get_lower怎么用?Python Conf.get_lower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在galicaster.core.conf.Conf的用法示例。


在下文中一共展示了Conf.get_lower方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_lower

# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_lower [as 别名]
    def test_get_lower(self):
        conf = Conf()
        for lower in ['RUBENRUA', 'RubenRua', 'RubenruA', 'rubenrua']:
            conf.set('s', 'k', lower)
            self.assertEqual(conf.get_lower('s', 'k'), 'rubenrua')

        self.assertEqual(conf.get_lower('s', 'k_not_exists'), None)
开发者ID:CGreweling,项目名称:Galicaster,代码行数:9,代码来源:conf.py

示例2: test_get_boolean_int_lower

# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_lower [as 别名]
    def test_get_boolean_int_lower(self):
        conf = Conf()
        for yes in ['True', 'true', 'yes', 'si', 'y', 'OK', 'Y', 'TRUE']:
            conf.set('s', 'k', yes)
            self.assertTrue(conf.get_boolean('s', 'k'), 'Check if {0} is True'.format(yes))

        for no in ['None', 'not', 'False', 'no', 'n']:
            conf.set('s', 'k', no)
            self.assertFalse(conf.get_boolean('s', 'k'), 'Check if {0} is False'.format(no))
        
        for lower in ['RUBENRUA', 'RubenRua', 'RubenruA', 'rubenrua']:
            conf.set('s', 'k', lower)
            self.assertEqual(conf.get_lower('s', 'k'), 'rubenrua')

        self.assertEqual(conf.get_lower('s', 'k_not_exists'), None)

        conf.set('s', 'k', '10')
        self.assertEqual(conf.get_int('s', 'k'), 10)
开发者ID:qingke678,项目名称:galicaster-uib,代码行数:20,代码来源:conf.py

示例3: test_get_boolean_int_lower

# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_lower [as 别名]
    def test_get_boolean_int_lower(self):
        conf = Conf()
        for yes in ["True", "true", "yes", "si", "y", "OK", "Y", "TRUE"]:
            conf.set("s", "k", yes)
            self.assertTrue(conf.get_boolean("s", "k"), "Check if {0} is True".format(yes))

        for no in ["None", "not", "False", "no", "n"]:
            conf.set("s", "k", no)
            self.assertFalse(conf.get_boolean("s", "k"), "Check if {0} is False".format(no))

        for lower in ["RUBENRUA", "RubenRua", "RubenruA", "rubenrua"]:
            conf.set("s", "k", lower)
            self.assertEqual(conf.get_lower("s", "k"), "rubenrua")

        self.assertEqual(conf.get_lower("s", "k_not_exists"), None)

        conf.set("s", "k", "10")
        self.assertEqual(conf.get_int("s", "k"), 10)
开发者ID:MasterFox,项目名称:Galicaster,代码行数:20,代码来源:conf.py

示例4: TestFunctions

# 需要导入模块: from galicaster.core.conf import Conf [as 别名]
# 或者: from galicaster.core.conf.Conf import get_lower [as 别名]

#.........这里部分代码省略.........
        self.assertEqual(profile.name, 'New Profile')

        profile = Profile('test')
        self.assertEqual(profile.name, 'test')


    def test_add_track_to_profile(self):
        profile = Profile()
        self.assertEqual(0, len(profile.tracks))

        t1 = profile.new_track({})
        self.assertEqual(1, len(profile.tracks))

        t2 = Track()
        profile.add_track(t2)
        self.assertEqual(2, len(profile.tracks))

        profile.remove_track(t2)
        self.assertEqual(1, len(profile.tracks))


    def test_get_boolean(self):
        for yes in ['True', 'true', 'yes', 'si', 'y', 'OK', 'Y', 'TRUE']:
            self.conf.set('s', 'k', yes)
            self.assertTrue(self.conf.get_boolean('s', 'k'), 'Check if {0} is True'.format(yes))

        for no in ['None', 'not', 'False', 'no', 'n']:
            self.conf.set('s', 'k', no)
            self.assertFalse(self.conf.get_boolean('s', 'k'), 'Check if {0} is False'.format(no))

        self.conf.set('s', 'k', 1)
        self.assertFalse(self.conf.get_boolean('s', 'k', False))

    def test_get_lower(self):
        for lower in ['RUBENRUA', 'RubenRua', 'RubenruA', 'rubenrua']:
            self.conf.set('s', 'k', lower)
            self.assertEqual(self.conf.get_lower('s', 'k'), 'rubenrua')

        self.assertEqual(self.conf.get_lower('s', 'k_not_exists', None), None)

        self.conf.set('s', 'k', 'TEST')
        self.assertEqual(self.conf.get_lower('s', 'k'), 'test')

        self.conf.set('s', 'k2', 1234)
        self.assertEqual(self.conf.get_lower('s', 'k2', 'testing'), 'testing')


    def test_get_int(self):
        self.conf.set('s', 'k', '10')
        self.assertEqual(self.conf.get_int('s', 'k'), 10)

        self.conf.set('s', 'k2', 'test')
        self.assertEqual(self.conf.get_int('s', 'k2', 20), 20)


    def test_get_hour(self):
        self.conf.set('s', 'k', '12:34')
        self.assertEqual(self.conf.get_hour('s', 'k'), '12:34')

        self.conf.set('s', 'k2', 'test')
        self.assertEqual(self.conf.get_hour('s', 'k2', '11:11'), '11:11')


    def test_get_list(self):
        self.assertEqual(self.conf.get_list('s', 'k'), [])
开发者ID:SussexLearningSystems,项目名称:Galicaster,代码行数:69,代码来源:conf.py


注:本文中的galicaster.core.conf.Conf.get_lower方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。