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


Python SimpleConfig.get方法代码示例

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


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

示例1: test_simple_config_key_rename

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_simple_config_key_rename(self):
     """auto_cycle was renamed auto_connect"""
     fake_read_user = lambda _: {"auto_cycle": True}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options=self.options,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(config.get("auto_connect"), True)
     self.assertEqual(config.get("auto_cycle"), None)
     fake_read_user = lambda _: {"auto_connect": False, "auto_cycle": True}
     config = SimpleConfig(options=self.options,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(config.get("auto_connect"), False)
     self.assertEqual(config.get("auto_cycle"), None)
开发者ID:bauerj,项目名称:electrum,代码行数:17,代码来源:test_simple_config.py

示例2: test_can_set_options_set_in_user_config

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_can_set_options_set_in_user_config(self):
     another_path = tempfile.mkdtemp()
     fake_read_user = lambda _: {"electrum_path": self.electrum_dir}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options={},
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     config.set_key("electrum_path", another_path)
     self.assertEqual(another_path, config.get("electrum_path"))
开发者ID:bauerj,项目名称:electrum,代码行数:11,代码来源:test_simple_config.py

示例3: test_cannot_set_options_passed_by_command_line

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_cannot_set_options_passed_by_command_line(self):
     fake_read_user = lambda _: {"electrum_path": "b"}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options=self.options,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     config.set_key("electrum_path", "c")
     self.assertEqual(self.options.get("electrum_path"),
                      config.get("electrum_path"))
开发者ID:bauerj,项目名称:electrum,代码行数:11,代码来源:test_simple_config.py

示例4: test_simple_config_user_config_overrides_system_config

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_simple_config_user_config_overrides_system_config(self):
     """Options passed in user config override system config."""
     fake_read_system = lambda : {"electrum_path": self.electrum_dir}
     fake_read_user = lambda _: {"electrum_path": "b"}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options={},
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual("b", config.get("electrum_path"))
开发者ID:JustinTArthur,项目名称:electrum,代码行数:12,代码来源:test_simple_config.py

示例5: test_can_set_options_from_system_config

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_can_set_options_from_system_config(self):
     fake_read_system = lambda : {"electrum_path": self.electrum_dir}
     fake_read_user = lambda _: {}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options={},
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     config.set_key("electrum_path", "c")
     self.assertEqual("c", config.get("electrum_path"))
开发者ID:JustinTArthur,项目名称:electrum,代码行数:12,代码来源:test_simple_config.py

示例6: test_simple_config_user_config_is_used_if_others_arent_specified

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_simple_config_user_config_is_used_if_others_arent_specified(self):
     """If no system-wide configuration and no command-line options are
     specified, the user configuration is used instead."""
     fake_read_user = lambda _: {"electrum_path": self.electrum_dir}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options={},
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(self.options.get("electrum_path"),
                      config.get("electrum_path"))
开发者ID:bauerj,项目名称:electrum,代码行数:12,代码来源:test_simple_config.py

示例7: test_simple_config_command_line_overrides_everything

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_simple_config_command_line_overrides_everything(self):
     """Options passed by command line override all other configuration
     sources"""
     fake_read_user = lambda _: {"electrum_path": "b"}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options=self.options,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(self.options.get("electrum_path"),
                      config.get("electrum_path"))
开发者ID:bauerj,项目名称:electrum,代码行数:12,代码来源:test_simple_config.py

示例8: test_simple_config_system_config_ignored_if_portable

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_simple_config_system_config_ignored_if_portable(self):
     """If electrum is started with the "portable" flag, system
     configuration is completely ignored."""
     fake_read_system = lambda : {"some_key": "some_value"}
     fake_read_user = lambda _: {}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options={"portable": True},
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(config.get("some_key"), None)
开发者ID:JustinTArthur,项目名称:electrum,代码行数:13,代码来源:test_simple_config.py

示例9: test_simple_config_system_config_ignored_if_portable

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_simple_config_system_config_ignored_if_portable(self):
     """If electrum is started with the "portable" flag, system
     configuration is completely ignored."""
     another_path = tempfile.mkdtemp()
     fake_read_system = lambda : {"electrum_path": self.electrum_dir}
     fake_read_user = lambda _: {"electrum_path": another_path}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options={"portable": True},
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     self.assertEqual(another_path, config.get("electrum_path"))
开发者ID:vergecurrency,项目名称:electrum-xvg,代码行数:14,代码来源:test_simple_config.py

示例10: test_can_set_options_from_system_config_if_portable

# 需要导入模块: from lib.simple_config import SimpleConfig [as 别名]
# 或者: from lib.simple_config.SimpleConfig import get [as 别名]
 def test_can_set_options_from_system_config_if_portable(self):
     """If the "portable" flag is set, the user can overwrite system
     configuration options."""
     another_path = tempfile.mkdtemp()
     fake_read_system = lambda : {"electrum_path": self.electrum_dir}
     fake_read_user = lambda _: {}
     read_user_dir = lambda : self.user_dir
     config = SimpleConfig(options={"portable": True},
                           read_system_config_function=fake_read_system,
                           read_user_config_function=fake_read_user,
                           read_user_dir_function=read_user_dir)
     config.set_key("electrum_path", another_path)
     self.assertEqual(another_path, config.get("electrum_path"))
开发者ID:JustinTArthur,项目名称:electrum,代码行数:15,代码来源:test_simple_config.py


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