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


Python config.Config類代碼示例

本文整理匯總了Python中simple_virtuoso_migrate.config.Config的典型用法代碼示例。如果您正苦於以下問題:Python Config類的具體用法?Python Config怎麽用?Python Config使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: test_it_should_raise_exception_for_an_inexistent_config_value_without_specify_a_default_value

 def test_it_should_raise_exception_for_an_inexistent_config_value_without_specify_a_default_value(self):
     config = Config()
     config.put("some_key", "some_value")
     try:
         config.get("ANOTHER_KEY")
     except Exception, e:
         self.assertEqual("invalid key ('another_key')", str(e))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:7,代碼來源:config_test.py

示例2: test_it_should_not_update_saved_config_values

 def test_it_should_not_update_saved_config_values(self):
     config = Config()
     config.put("some_key", "some_value")
     try:
         config.put("some_key", "another_value")
     except Exception, e:
         self.assertEqual("the configuration key 'some_key' already exists and you cannot override any configuration", str(e))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:7,代碼來源:config_test.py

示例3: test_it_should_raise_exception_when_removing_an_inexistent_config_value

 def test_it_should_raise_exception_when_removing_an_inexistent_config_value(self):
     config = Config()
     config.put("some_key", "some_value")
     try:
         config.remove("ANOTHER_KEY")
     except Exception, e:
         self.assertEqual("invalid configuration key ('another_key')", str(e))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:7,代碼來源:config_test.py

示例4: test_it_should_transform_keys_to_lower_case

 def test_it_should_transform_keys_to_lower_case(self):
     config = Config()
     config.put("sOmE_kEy", "original_value")
     self.assertEqual("original_value", config.get("SoMe_KeY"))
     config.update("sOMe_kEy", "new_value")
     self.assertEqual("new_value", config.get("some_KEY"))
     config.remove("SOME_KEY")
     self.assertRaises(Exception, config.get, "sOMe_KEY")
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:8,代碼來源:config_test.py

示例5: test_it_should_parse_migrations_dir_with_multiple_relative_dirs

 def test_it_should_parse_migrations_dir_with_multiple_relative_dirs(self):
     dirs = Config._parse_migrations_dir('test:migrations:./a/relative/path:another/path')
     self.assertEqual(4, len(dirs))
     self.assertEqual(os.path.abspath('test'), dirs[0])
     self.assertEqual(os.path.abspath('migrations'), dirs[1])
     self.assertEqual(os.path.abspath('./a/relative/path'), dirs[2])
     self.assertEqual(os.path.abspath('another/path'), dirs[3])
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:7,代碼來源:config_test.py

示例6: test_it_should_parse_migrations_dir_with_mixed_relative_and_absolute_dirs

 def test_it_should_parse_migrations_dir_with_mixed_relative_and_absolute_dirs(self):
     dirs = Config._parse_migrations_dir('%s:%s:%s:%s' % ('/tmp/test', '.', './a/relative/path', os.path.abspath('another/path')))
     self.assertEqual(4, len(dirs))
     self.assertEqual('/tmp/test', dirs[0])
     self.assertEqual(os.path.abspath('.'), dirs[1])
     self.assertEqual(os.path.abspath('./a/relative/path'), dirs[2])
     self.assertEqual(os.path.abspath('another/path'), dirs[3])
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:7,代碼來源:config_test.py

示例7: test_it_should_parse_migrations_dir_with_relative_dirs_using_config_dir_parameter_as_base_path

 def test_it_should_parse_migrations_dir_with_relative_dirs_using_config_dir_parameter_as_base_path(self):
     dirs = Config._parse_migrations_dir(
             '%s:%s:%s:%s' % ('/tmp/test', '.', './a/relative/path', os.path.abspath('another/path')),
             config_dir='/base/path_to_relative_dirs'
     )
     self.assertEqual(4, len(dirs))
     self.assertEqual('/tmp/test', dirs[0])
     self.assertEqual('/base/path_to_relative_dirs', dirs[1])
     self.assertEqual('/base/path_to_relative_dirs/a/relative/path', dirs[2])
     self.assertEqual(os.path.abspath('another/path'), dirs[3])
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:10,代碼來源:config_test.py

示例8: test_it_should_accept_initial_values_as_configuration

 def test_it_should_accept_initial_values_as_configuration(self):
     config = Config({"some_key": "some_value"})
     self.assertEqual("some_value", config.get("some_key"))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:3,代碼來源:config_test.py

示例9: test_it_should_remove_saved_config_values

 def test_it_should_remove_saved_config_values(self):
     config = Config()
     config.put("some_key", "some_value")
     initial = str(config)
     config.remove("some_key")
     self.assertNotEqual(initial, str(config))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:6,代碼來源:config_test.py

示例10: test_it_should_parse_migrations_dir_with_one_relative_dir

 def test_it_should_parse_migrations_dir_with_one_relative_dir(self):
     dirs = Config._parse_migrations_dir('.')
     self.assertEqual(1, len(dirs))
     self.assertEqual(os.path.abspath('.'), dirs[0])
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:4,代碼來源:config_test.py

示例11: test_it_should_accept_non_empty_stringand_false_as_default_value

 def test_it_should_accept_non_empty_stringand_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))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:5,代碼來源:config_test.py

示例12: test_it_should_return_default_value_for_an_inexistent_dict_value

 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"))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:3,代碼來源:config_test.py

示例13: test_it_should_raise_exception_for_an_inexistent_dict_value_without_specify_a_default_value

 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))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:6,代碼來源:config_test.py

示例14: test_it_should_return_previous_saved_config_values

 def test_it_should_return_previous_saved_config_values(self):
     config = Config()
     config.put("some_key", "some_value")
     self.assertEqual("some_value", config.get("some_key"))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:4,代碼來源:config_test.py

示例15: test_it_should_return_value_from_a_dict

 def test_it_should_return_value_from_a_dict(self):
     _dict = {"some_key": "some_value"}
     self.assertEqual("some_value", Config._get(_dict, "some_key"))
開發者ID:icaromedeiros,項目名稱:simple-virtuoso-migrate,代碼行數:3,代碼來源:config_test.py


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