From a3532632af32d72cc4877f98bf2a786b2d0505be Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Thu, 1 Oct 2015 09:48:04 +0100 Subject: [PATCH] Unicode/bytes tests for unquote_unreserved --- test_requests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test_requests.py b/test_requests.py index 45afd517..7baaf38e 100755 --- a/test_requests.py +++ b/test_requests.py @@ -1468,6 +1468,20 @@ class TestUtils: quoted = 'http://example.com/fiz?buz=%25ppicture' assert quoted == requote_uri(quoted) + def test_unquote_unreserved_handles_unicode(self): + """Unicode strings can be passed to unquote_unreserved""" + from requests.utils import unquote_unreserved + uri = u'http://example.com/fizz?buzz=%41%2C' + unquoted = u'http://example.com/fizz?buzz=A%2C' + assert unquoted == unquote_unreserved(uri) + + def test_unquote_unreserved_handles_bytes(self): + """Bytestrings can be passed to unquote_unreserved""" + from requests.utils import unquote_unreserved + uri = b'http://example.com/fizz?buzz=%41%2C' + unquoted = b'http://example.com/fizz?buzz=A%2C' + assert unquoted == unquote_unreserved(uri) + class TestMorselToCookieExpires: """Tests for morsel_to_cookie when morsel contains expires."""