本文整理汇总了Python中txtorcon.TorConfig.bar方法的典型用法代码示例。如果您正苦于以下问题:Python TorConfig.bar方法的具体用法?Python TorConfig.bar怎么用?Python TorConfig.bar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txtorcon.TorConfig
的用法示例。
在下文中一共展示了TorConfig.bar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_save_boolean_with_strange_values
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import bar [as 别名]
def test_save_boolean_with_strange_values(self):
self.protocol.answers.append('config/names=\nfoo Boolean\nbar Boolean')
self.protocol.answers.append({'foo': '0'})
self.protocol.answers.append({'bar': '1'})
conf = TorConfig(self.protocol)
# save some non-boolean value
conf.foo = "Something True"
conf.bar = 0
conf.save()
self.assertEqual(set(self.protocol.sets),
set([('foo', 1), ('bar', 0)]))
示例2: test_read_boolean_after_save
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import bar [as 别名]
def test_read_boolean_after_save(self):
self.protocol.answers.append('config/names=\nfoo Boolean\nbar Boolean')
self.protocol.answers.append({'foo': '0'})
self.protocol.answers.append({'bar': '1'})
conf = TorConfig(self.protocol)
# save some boolean value
conf.foo = True
conf.bar = False
conf.save()
self.assertTrue(conf.foo is True, msg="foo not True: %s" % conf.foo)
self.assertTrue(conf.bar is False, msg="bar not False: %s" % conf.bar)
示例3: test_save_boolean
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import bar [as 别名]
def test_save_boolean(self):
self.protocol.answers.append('config/names=\nfoo Boolean\nbar Boolean')
self.protocol.answers.append({'foo': '0'})
self.protocol.answers.append({'bar': '1'})
conf = TorConfig(self.protocol)
# save some boolean value
conf.foo = True
conf.bar = False
conf.save()
self.assertEqual(set(self.protocol.sets),
set([('foo', 1), ('bar', 0)]))
示例4: test_save_boolean_auto
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import bar [as 别名]
def test_save_boolean_auto(self):
self.protocol.answers.append(
'config/names=\nfoo Boolean+Auto\nbar Boolean+Auto\nbaz Boolean+Auto\nqux Boolean+Auto'
)
self.protocol.answers.append({'foo': '1'})
self.protocol.answers.append({'bar': '1'})
self.protocol.answers.append({'baz': '1'})
self.protocol.answers.append({'qux': '1'})
conf = TorConfig(self.protocol)
conf.foo = 1
conf.bar = 0
conf.baz = True
conf.qux = -1
conf.save()
self.assertEqual(set(self.protocol.sets),
set([('foo', 1),
('bar', 0),
('baz', 1),
('qux', 'auto')]))
self.assertTrue(conf.foo is 1)
self.assertTrue(conf.bar is 0)
self.assertTrue(conf.baz is 1)
self.assertTrue(conf.qux is -1)