示例#1
0
 def test_join_segments_encodes_non_ascii_and_special_characters_including_slash(
         self):
     assert URLPath.join_segments((
         'a b',
         u('d/\N{LATIN SMALL LETTER E WITH ACUTE}'))) == '/a%20b/d%2F%C3%A9'
示例#2
0
 def test_add_encodes_non_ascii_and_reserved_characters(self):
     assert URLPath('/a/b/c').add(
         u('d /\N{LATIN SMALL LETTER E WITH ACUTE}')
     ) == '/a/b/c/d%20/%C3%A9'
示例#3
0
 def test_list_correctly_decodes_utf_8(self):
     assert QueryString('foo=%EF%BF%BD').list == [('foo', u('\ufffd'))]
示例#4
0
 def test_add_param_encodes_utf8(self):
     s = QueryString('abc=123')
     assert s.add_param('foo', u('\ufffd')) == 'abc=123&foo=%EF%BF%BD'
示例#5
0
 def setUp(self):
     self.url_string = u("https://github.com/fish2000/urlstring?spam=eggs#foo")
示例#6
0
 def test_add_param_encodes_utf8(self):
     s = QueryString('abc=123')
     assert s.add_param('foo', u('\ufffd')) == 'abc=123&foo=%EF%BF%BD'
示例#7
0
 def test_list_correctly_decodes_utf_8(self):
     assert QueryString('foo=%EF%BF%BD').list == [('foo', u('\ufffd'))]
示例#8
0
 def test_add_encodes_non_ascii_and_reserved_characters(self):
     assert URLPath('/a/b/c').add(u('d /\N{LATIN SMALL LETTER E WITH ACUTE}')) == '/a/b/c/d%20/%C3%A9'
示例#9
0
 def test_join_segments_encodes_non_ascii_and_special_characters_including_slash(self):
     assert URLPath.join_segments(('a b', u('d/\N{LATIN SMALL LETTER E WITH ACUTE}'))) == '/a%20b/d%2F%C3%A9'