summaryrefslogtreecommitdiff
path: root/tests/handlers/tests.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2016-12-01 11:38:01 +0100
committerClaude Paroz <claude@2xlibre.net>2017-01-18 16:21:28 +0100
commitc716fe87821df00f9f03ecc761c914d1682591a2 (patch)
tree0436706cdb190acbc76fb5fcf6d66f16e09fafa3 /tests/handlers/tests.py
parente63d98b7beb16d1410168a2315cbe04c43c9c80d (diff)
Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
Diffstat (limited to 'tests/handlers/tests.py')
-rw-r--r--tests/handlers/tests.py20
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py
index bae2043918..72ba98b1d3 100644
--- a/tests/handlers/tests.py
+++ b/tests/handlers/tests.py
@@ -34,7 +34,7 @@ class HandlerTests(SimpleTestCase):
produces a 404.
"""
environ = RequestFactory().get('/').environ
- environ['PATH_INFO'] = b'\xed' if six.PY2 else '\xed'
+ environ['PATH_INFO'] = '\xed'
handler = WSGIHandler()
response = handler(environ, lambda *a, **k: None)
# The path of the request will be encoded to '/%ED'.
@@ -53,25 +53,17 @@ class HandlerTests(SimpleTestCase):
]
got = []
for raw_query_string in raw_query_strings:
- if six.PY3:
- # Simulate http.server.BaseHTTPRequestHandler.parse_request handling of raw request
- environ['QUERY_STRING'] = str(raw_query_string, 'iso-8859-1')
- else:
- environ['QUERY_STRING'] = raw_query_string
+ # Simulate http.server.BaseHTTPRequestHandler.parse_request handling of raw request
+ environ['QUERY_STRING'] = str(raw_query_string, 'iso-8859-1')
request = WSGIRequest(environ)
got.append(request.GET['want'])
- if six.PY2:
- self.assertListEqual(got, ['café', 'café', 'café', 'café'])
- else:
- # On Python 3, %E9 is converted to the unicode replacement character by parse_qsl
- self.assertListEqual(got, ['café', 'café', 'caf\ufffd', 'café'])
+ # %E9 is converted to the unicode replacement character by parse_qsl
+ self.assertListEqual(got, ['café', 'café', 'caf\ufffd', 'café'])
def test_non_ascii_cookie(self):
"""Non-ASCII cookies set in JavaScript are properly decoded (#20557)."""
environ = RequestFactory().get('/').environ
- raw_cookie = 'want="café"'
- if six.PY3:
- raw_cookie = raw_cookie.encode('utf-8').decode('iso-8859-1')
+ raw_cookie = 'want="café"'.encode('utf-8').decode('iso-8859-1')
environ['HTTP_COOKIE'] = raw_cookie
request = WSGIRequest(environ)
# If would be nicer if request.COOKIES returned unicode values.