mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #26125 -- Fixed E731 flake warnings.
This commit is contained in:
parent
abc0777b63
commit
60586dd737
36 changed files with 176 additions and 75 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue