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'
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'
def test_list_correctly_decodes_utf_8(self): assert QueryString('foo=%EF%BF%BD').list == [('foo', u('\ufffd'))]
def test_add_param_encodes_utf8(self): s = QueryString('abc=123') assert s.add_param('foo', u('\ufffd')) == 'abc=123&foo=%EF%BF%BD'
def setUp(self): self.url_string = u("https://github.com/fish2000/urlstring?spam=eggs#foo")
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'
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'