本文整理汇总了Python中dulwich.config.ConfigDict类的典型用法代码示例。如果您正苦于以下问题:Python ConfigDict类的具体用法?Python ConfigDict怎么用?Python ConfigDict使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConfigDict类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_config_proxy
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)
示例2: test_get_boolean
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")
示例3: test_get_set
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"))
示例4: test_iteritems
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", ))))
示例5: test_dict
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')
示例6: test_dict
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')
示例7: test_itersections
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
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
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')