本文整理汇总了Python中urlobject.query_string.QueryString.add_param方法的典型用法代码示例。如果您正苦于以下问题:Python QueryString.add_param方法的具体用法?Python QueryString.add_param怎么用?Python QueryString.add_param使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类urlobject.query_string.QueryString
的用法示例。
在下文中一共展示了QueryString.add_param方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_params_with_multiple_values_adds_the_same_parameter_multiple_times
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_params_with_multiple_values_adds_the_same_parameter_multiple_times(self):
s = QueryString(u'')
assert (s.add_params({u'foo': [u'bar', u'baz']}) ==
s.add_param(u'foo', u'bar').add_param(u'foo', u'baz'))
示例2: test_add_param_encodes_and_adds_the_given_parameter_to_the_QueryString
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_encodes_and_adds_the_given_parameter_to_the_QueryString(self):
s = QueryString(u'')
assert s.add_param(u'abc', u'123') == u'abc=123'
assert (s.add_param(u'abc', u'123')
.add_param(u'def', u'456') == u'abc=123&def=456')
示例3: test_add_param_accepts_int
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_accepts_int(self):
s = QueryString('')
assert s.add_param('abc', 123) == 'abc=123'
示例4: test_add_params_is_equivalent_to_calling_add_param_multiple_times
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_params_is_equivalent_to_calling_add_param_multiple_times(self):
s = QueryString(u'')
assert (s.add_params([(u'abc', u'123'), (u'def', u'456')]) ==
s.add_param(u'abc', u'123').add_param(u'def', u'456'))
示例5: test_add_param_allows_the_same_parameter_name_to_be_added_twice
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_allows_the_same_parameter_name_to_be_added_twice(self):
s = QueryString(u'abc=123')
assert s.add_param(u'abc', u'456') == u'abc=123&abc=456'
示例6: test_add_params_with_multiple_values_adds_the_same_parameter_multiple_times
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_params_with_multiple_values_adds_the_same_parameter_multiple_times(self):
s = QueryString("")
assert s.add_params({"foo": ["bar", "baz"]}) == s.add_param("foo", "bar").add_param("foo", "baz")
示例7: test_add_param_accepts_int
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_accepts_int(self):
s = QueryString("")
assert s.add_param("abc", 123) == "abc=123"
示例8: test_add_param_can_add_anonymous_parameters
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_can_add_anonymous_parameters(self):
s = QueryString(u'abc=123')
assert s.add_param(u'', u'456') == u'abc=123&=456'
示例9: test_add_param_can_add_anonymous_parameters
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_can_add_anonymous_parameters(self):
s = QueryString("abc=123")
assert s.add_param("", "456") == "abc=123&=456"
示例10: test_add_param_encodes_utf8
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_encodes_utf8(self):
s = QueryString("abc=123")
assert s.add_param("foo", u("\ufffd")) == "abc=123&foo=%EF%BF%BD"
示例11: test_add_param_can_add_empty_valued_parameters
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_can_add_empty_valued_parameters(self):
s = QueryString("abc=123")
assert s.add_param("def", "") == "abc=123&def="
示例12: test_add_param_can_add_valueless_parameters
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_can_add_valueless_parameters(self):
s = QueryString("abc=123")
assert s.add_param("def", None) == "abc=123&def"
示例13: test_add_param_encodes_and_adds_the_given_parameter_to_the_QueryString
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_encodes_and_adds_the_given_parameter_to_the_QueryString(self):
s = QueryString("")
assert s.add_param("abc", "123") == "abc=123"
assert s.add_param("abc", "123").add_param("def", "456") == "abc=123&def=456"
示例14: test_add_param_can_add_valueless_parameters
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_can_add_valueless_parameters(self):
s = QueryString(u'abc=123')
assert s.add_param(u'def', None) == u'abc=123&def'
示例15: test_add_param_allows_the_same_parameter_name_to_be_added_twice
# 需要导入模块: from urlobject.query_string import QueryString [as 别名]
# 或者: from urlobject.query_string.QueryString import add_param [as 别名]
def test_add_param_allows_the_same_parameter_name_to_be_added_twice(self):
s = QueryString("abc=123")
assert s.add_param("abc", "456") == "abc=123&abc=456"