本文整理汇总了Python中w3af.core.data.dc.generic.kv_container.KeyValueContainer.iter_setters方法的典型用法代码示例。如果您正苦于以下问题:Python KeyValueContainer.iter_setters方法的具体用法?Python KeyValueContainer.iter_setters怎么用?Python KeyValueContainer.iter_setters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w3af.core.data.dc.generic.kv_container.KeyValueContainer
的用法示例。
在下文中一共展示了KeyValueContainer.iter_setters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_iter_setters
# 需要导入模块: from w3af.core.data.dc.generic.kv_container import KeyValueContainer [as 别名]
# 或者: from w3af.core.data.dc.generic.kv_container.KeyValueContainer import iter_setters [as 别名]
def test_iter_setters(self):
dc = KeyValueContainer([(u'a', ['1']), (u'b', ['2', '3'])])
kv_setter = [(k, v, p, s) for (k, v, p, s) in dc.iter_setters()]
EXPECTED_KEY_VALUES = [('a', '1', ('a', 0)),
('b', '2', ('b', 0)),
('b', '3', ('b', 1))]
kvp = [(key, value, path) for (key, value, path, _) in kv_setter]
self.assertEqual(EXPECTED_KEY_VALUES, kvp)
for idx, (key, value, path, setter) in enumerate(kv_setter):
if idx == 2:
setter('w')
self.assertEqual(str(dc), 'a=1&b=2&b=w')
SET_VALUES = ['x', 'y', 'z']
for idx, (key, value, path, setter) in enumerate(kv_setter):
setter(SET_VALUES[idx])
self.assertEqual(str(dc), 'a=x&b=y&b=z')