本文整理汇总了Python中simple_db_migrate.config.Config._get方法的典型用法代码示例。如果您正苦于以下问题:Python Config._get方法的具体用法?Python Config._get怎么用?Python Config._get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simple_db_migrate.config.Config
的用法示例。
在下文中一共展示了Config._get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_it_should_accept_non_empty_string_and_false_as_default_value
# 需要导入模块: from simple_db_migrate.config import Config [as 别名]
# 或者: from simple_db_migrate.config.Config import _get [as 别名]
def test_it_should_accept_non_empty_string_and_false_as_default_value(self):
_dict = {"some_key": "some_value"}
self.assertEqual(None, Config._get(_dict,"ANOTHER_KEY", None))
self.assertEqual("", Config._get(_dict,"ANOTHER_KEY", ""))
self.assertEqual(False, Config._get(_dict,"ANOTHER_KEY", False))
示例2: test_it_should_raise_exception_for_an_inexistent_dict_value_without_specify_a_default_value
# 需要导入模块: from simple_db_migrate.config import Config [as 别名]
# 或者: from simple_db_migrate.config.Config import _get [as 别名]
def test_it_should_raise_exception_for_an_inexistent_dict_value_without_specify_a_default_value(self):
_dict = {"some_key": "some_value"}
try:
Config._get(_dict, "ANOTHER_KEY")
except Exception, e:
self.assertEqual("invalid key ('ANOTHER_KEY')", str(e))
示例3: test_it_should_return_default_value_for_an_inexistent_dict_value
# 需要导入模块: from simple_db_migrate.config import Config [as 别名]
# 或者: from simple_db_migrate.config.Config import _get [as 别名]
def test_it_should_return_default_value_for_an_inexistent_dict_value(self):
_dict = {"some_key": "some_value"}
self.assertEqual("default_value", Config._get(_dict, "ANOTHER_KEY", "default_value"))
示例4: test_it_should_return_default_value_for_an_none_dict_value
# 需要导入模块: from simple_db_migrate.config import Config [as 别名]
# 或者: from simple_db_migrate.config.Config import _get [as 别名]
def test_it_should_return_default_value_for_an_none_dict_value(self):
_dict = {"some_key": None}
self.assertEqual("default_value", Config._get(_dict, "some_key", "default_value"))
示例5: test_it_should_return_value_from_a_dict_even_if_a_default_value_given
# 需要导入模块: from simple_db_migrate.config import Config [as 别名]
# 或者: from simple_db_migrate.config.Config import _get [as 别名]
def test_it_should_return_value_from_a_dict_even_if_a_default_value_given(self):
_dict = {"some_key": "some_value"}
self.assertEqual("some_value", Config._get(_dict, "some_key", "default_value"))
示例6: test_it_should_return_value_from_a_dict
# 需要导入模块: from simple_db_migrate.config import Config [as 别名]
# 或者: from simple_db_migrate.config.Config import _get [as 别名]
def test_it_should_return_value_from_a_dict(self):
_dict = {"some_key": "some_value"}
self.assertEqual("some_value", Config._get(_dict, "some_key"))