本文整理汇总了Python中dulwich.config.ConfigDict.set方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigDict.set方法的具体用法?Python ConfigDict.set怎么用?Python ConfigDict.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dulwich.config.ConfigDict
的用法示例。
在下文中一共展示了ConfigDict.set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_set
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_get_set(self):
cd = ConfigDict()
self.assertRaises(KeyError, cd.get, "foo", "core")
cd.set(("core", ), "foo", "bla")
self.assertEquals("bla", cd.get(("core", ), "foo"))
cd.set(("core", ), "foo", "bloe")
self.assertEquals("bloe", cd.get(("core", ), "foo"))
示例2: test_iteritems
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_iteritems(self):
cd = ConfigDict()
cd.set((b"core", ), b"foo", b"bla")
cd.set((b"core2", ), b"foo", b"bloe")
self.assertEqual(
[(b'foo', b'bla')],
list(cd.iteritems((b"core", ))))
示例3: test_dict
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_dict(self):
cd = ConfigDict()
cd.set((b"core", ), b"foo", b"bla")
cd.set((b"core2", ), b"foo", b"bloe")
self.assertEqual([(b"core", ), (b"core2", )], list(cd.keys()))
self.assertEqual(cd[(b"core", )], {b'foo': b'bla'})
cd[b'a'] = b'b'
self.assertEqual(cd[b'a'], b'b')
示例4: test_dict
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_dict(self):
cd = ConfigDict()
cd.set(("core", ), "foo", "bla")
cd.set(("core2", ), "foo", "bloe")
self.assertEqual([("core2", ), ("core", )], cd.keys())
self.assertEqual(cd[("core", )], {'foo': 'bla'})
cd['a'] = 'b'
self.assertEqual(cd['a'], 'b')
示例5: test_config_proxy
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_config_proxy(self):
config = ConfigDict()
config.set(b'http', b'proxy', b'http://localhost:3128/')
manager = default_urllib3_manager(config=config)
self.assertIsInstance(manager, urllib3.ProxyManager)
self.assertTrue(hasattr(manager, 'proxy'))
self.assertEqual(manager.proxy.scheme, 'http')
self.assertEqual(manager.proxy.host, 'localhost')
self.assertEqual(manager.proxy.port, 3128)
示例6: test_get_boolean
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_get_boolean(self):
cd = ConfigDict()
cd.set(("core", ), "foo", "true")
self.assertTrue(cd.get_boolean(("core", ), "foo"))
cd.set(("core", ), "foo", "false")
self.assertFalse(cd.get_boolean(("core", ), "foo"))
cd.set(("core", ), "foo", "invalid")
self.assertRaises(ValueError, cd.get_boolean, ("core", ), "foo")
示例7: test_itersections
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_itersections(self):
cd = ConfigDict()
cd.set((b"core2", ), b"foo", b"bloe")
self.assertEqual([(b"core2", )],
list(cd.itersections()))
示例8: test_iteritems_nonexistant
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_iteritems_nonexistant(self):
cd = ConfigDict()
cd.set((b"core2", ), b"foo", b"bloe")
self.assertEqual([],
list(cd.iteritems((b"core", ))))
示例9: test_config_no_ssl
# 需要导入模块: from dulwich.config import ConfigDict [as 别名]
# 或者: from dulwich.config.ConfigDict import set [as 别名]
def test_config_no_ssl(self):
config = ConfigDict()
config.set(b'http', b'sslVerify', b'false')
manager = default_urllib3_manager(config=config)
self.assertEqual(manager.connection_pool_kw['cert_reqs'],
'CERT_NONE')