Example #1
0
 def test_add_params_accepts_the_same_args_as_dict(self):
     s = QueryString("")
     added = s.add_params({"abc": "123"}, foo="bar", xyz="456")
     assert added.dict == {"abc": "123", "foo": "bar", "xyz": "456"}
     added2 = s.add_params([("abc", "123")], foo="bar", xyz="456")
     assert added2.dict == {"abc": "123", "foo": "bar", "xyz": "456"}
     # It also has to fail in the same way as `dict`. If you pass more than
     # one positional argument it should raise a TypeError.
     self.assertRaises(TypeError, s.add_params, {"abc": "123"}, {"foo": "bar"})
Example #2
0
 def test_add_params_accepts_the_same_args_as_dict(self):
     s = QueryString(u'')
     added = s.add_params({u'abc': u'123'}, foo=u'bar', xyz='456')
     assert added.dict == {u'abc': u'123', u'foo': u'bar', u'xyz': u'456'}
     added2 = s.add_params([(u'abc', u'123')], foo=u'bar', xyz='456')
     assert added2.dict == {u'abc': u'123', u'foo': u'bar', u'xyz': u'456'}
     # It also has to fail in the same way as `dict`. If you pass more than
     # one positional argument it should raise a TypeError.
     self.assertRaises(TypeError,
                       s.add_params, {'abc': '123'}, {'foo': 'bar'})
 def test_add_params_accepts_the_same_args_as_dict(self):
     s = QueryString('')
     added = s.add_params({'abc': '123'}, foo='bar', xyz='456')
     assert added.dict == {'abc': '123', 'foo': 'bar', 'xyz': '456'}
     added2 = s.add_params([('abc', '123')], foo='bar', xyz='456')
     assert added2.dict == {'abc': '123', 'foo': 'bar', 'xyz': '456'}
     # It also has to fail in the same way as `dict`. If you pass more than
     # one positional argument it should raise a TypeError.
     self.assertRaises(TypeError,
                       s.add_params, {'abc': '123'}, {'foo': 'bar'})
Example #4
0
 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'))
Example #5
0
 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'))
 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'))
 def test_add_params_is_equivalent_to_calling_add_param_multiple_times(self):
     s = QueryString('')
     assert (s.add_params([('abc', '123'), ('def', '456')]) ==
             s.add_param('abc', '123').add_param('def', '456'))
Example #8
0
 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")
Example #9
0
 def test_add_params_is_equivalent_to_calling_add_param_multiple_times(self):
     s = QueryString("")
     assert s.add_params([("abc", "123"), ("def", "456")]) == s.add_param("abc", "123").add_param("def", "456")