summaryrefslogtreecommitdiff
path: root/tests/test_client
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-01-25 13:59:25 -0500
committerGitHub <noreply@github.com>2017-01-25 13:59:25 -0500
commit1c466994d9729a8902d34e277a3a685bef2a08e1 (patch)
tree3a0c5ea4fc352aead66378f1fc2217feb6e1e2c7 /tests/test_client
parent11856ea44e4dd1ff2358c559c0d04ac848832c23 (diff)
downloaddjango-1c466994d9729a8902d34e277a3a685bef2a08e1.tar.gz
Refs #23919 -- Removed misc Python 2/3 references.
Diffstat (limited to 'tests/test_client')
-rw-r--r--tests/test_client/test_conditional_content_removal.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/tests/test_client/test_conditional_content_removal.py b/tests/test_client/test_conditional_content_removal.py
index 72bf7f238b..bd26b8fb52 100644
--- a/tests/test_client/test_conditional_content_removal.py
+++ b/tests/test_client/test_conditional_content_removal.py
@@ -1,19 +1,10 @@
import gzip
-import io
from django.http import HttpRequest, HttpResponse, StreamingHttpResponse
from django.test import SimpleTestCase
from django.test.client import conditional_content_removal
-# based on Python 3.3's gzip.compress
-def gzip_compress(data):
- buf = io.BytesIO()
- with gzip.GzipFile(fileobj=buf, mode='wb', compresslevel=0) as f:
- f.write(data)
- return buf.getvalue()
-
-
class ConditionalContentTests(SimpleTestCase):
def test_conditional_content_removal(self):
@@ -43,7 +34,7 @@ class ConditionalContentTests(SimpleTestCase):
self.assertEqual(b''.join(res), b'')
# Issue #20472
- abc = gzip_compress(b'abc')
+ abc = gzip.compress(b'abc')
res = HttpResponse(abc, status=304)
res['Content-Encoding'] = 'gzip'
conditional_content_removal(req, res)