本文整理汇总了Python中urlobject.query_string.QueryString.set_params方法的典型用法代码示例。如果您正苦于以下问题:Python QueryString.set_params方法的具体用法?Python QueryString.set_params怎么用?Python QueryString.set_params使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类urlobject.query_string.QueryString
的用法示例。
在下文中一共展示了QueryString.set_params方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_set_params_with_multiple_values_sets_the_same_name_multiple_times
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import set_params [as 别名]
def test_set_params_with_multiple_values_sets_the_same_name_multiple_times(self):
s = QueryString(u'foo=spam')
assert (s.set_params({u'foo': [u'bar', u'baz']}) ==
u'foo=bar&foo=baz')
s2 = QueryString(u'foo=bar&foo=baz')
assert (s2.set_params({u'foo': [u'spam', u'ham']}) ==
u'foo=spam&foo=ham')
示例2: test_set_params_accepts_the_same_args_as_dict
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import set_params [as 别名]
def test_set_params_accepts_the_same_args_as_dict(self):
s = QueryString(u'')
added = s.set_params({u'abc': u'123'}, abc='456')
assert added.dict == {u'abc': u'456'}
added2 = s.set_params([(u'abc', u'123')], abc=u'456')
assert added2.dict == {u'abc': u'456'}
示例3: test_set_params_is_equivalent_to_calling_set_param_multiple_times
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import set_params [as 别名]
def test_set_params_is_equivalent_to_calling_set_param_multiple_times(self):
s = QueryString(u'')
assert (s.set_params([(u'abc', u'123'), (u'def', u'456')]) ==
s.set_param(u'abc', u'123').set_param(u'def', u'456'))
示例4: test_set_params_with_multiple_values_sets_the_same_name_multiple_times
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import set_params [as 别名]
def test_set_params_with_multiple_values_sets_the_same_name_multiple_times(self):
s = QueryString("foo=spam")
assert s.set_params({"foo": ["bar", "baz"]}) == "foo=bar&foo=baz"
s2 = QueryString("foo=bar&foo=baz")
assert s2.set_params({"foo": ["spam", "ham"]}) == "foo=spam&foo=ham"
示例5: test_set_params_accepts_the_same_args_as_dict
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import set_params [as 别名]
def test_set_params_accepts_the_same_args_as_dict(self):
s = QueryString("")
added = s.set_params({"abc": "123"}, abc="456")
assert added.dict == {"abc": "456"}
added2 = s.set_params([("abc", "123")], abc="456")
assert added2.dict == {"abc": "456"}
示例6: test_set_params_is_equivalent_to_calling_set_param_multiple_times
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import set_params [as 别名]
def test_set_params_is_equivalent_to_calling_set_param_multiple_times(self):
s = QueryString("")
assert s.set_params([("abc", "123"), ("def", "456")]) == s.set_param("abc", "123").set_param("def", "456")