def test_quote_unicode(): """Quoting and unquoting Unicode strings should give the same result as when given regular strings. See ticket #28786. """ assert urllib_utf8.quote('montréal') == urllib_utf8.quote(u'montréal') assert urllib_utf8.quote_plus('montréal') == urllib_utf8.quote_plus(u'montréal') assert urllib_utf8.unquote('montréal') == urllib_utf8.unquote(u'montréal') assert urllib_utf8.unquote_plus('montréal') == urllib_utf8.unquote_plus(u'montréal')
def test_quote_and_quote_plus(): strings = ['', 'Hello there!', u'naïve', u' San José ', ' cafés'] for string in strings: utf8_string = string.encode('utf-8') if isinstance(string, unicode) else string assert urllib_utf8.quote(string) == urllib.quote(utf8_string) assert urllib_utf8.quote_plus(string) == urllib.quote_plus(utf8_string)