mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
Fixed #26125 -- Fixed E731 flake warnings.
This commit is contained in:
@@ -707,12 +707,11 @@ class GZipMiddlewareTest(SimpleTestCase):
|
||||
"""
|
||||
Compression is performed on FileResponse.
|
||||
"""
|
||||
open_file = lambda: open(__file__, 'rb')
|
||||
with open_file() as file1:
|
||||
with open(__file__, 'rb') as file1:
|
||||
file_resp = FileResponse(file1)
|
||||
file_resp['Content-Type'] = 'text/html; charset=UTF-8'
|
||||
r = GZipMiddleware().process_response(self.req, file_resp)
|
||||
with open_file() as file2:
|
||||
with open(__file__, 'rb') as file2:
|
||||
self.assertEqual(self.decompress(b''.join(r)), file2.read())
|
||||
self.assertEqual(r.get('Content-Encoding'), 'gzip')
|
||||
self.assertIsNot(r.file_to_stream, file1)
|
||||
|
||||
Reference in New Issue
Block a user