本文整理匯總了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"))