summaryrefslogtreecommitdiff
path: root/tests/responses
diff options
context:
space:
mode:
authorPiotr Kunicki <piotr.kunicki@o2.pl>2021-10-14 14:44:35 +0200
committerCarlton Gibson <carlton.gibson@noumenal.es>2021-10-14 15:05:27 +0200
commitcb8d7ca0ba0adc4fcefc069eae26f842a15755a1 (patch)
tree0b687b5be72edebacd324d774c901fc89cc5d7fd /tests/responses
parentdc724c5bf9d3b8d59c9571aa751c3cd001cdeced (diff)
downloaddjango-cb8d7ca0ba0adc4fcefc069eae26f842a15755a1.tar.gz
Refs #30509 -- Adjusted FileResponse test to close file earlier.
Diffstat (limited to 'tests/responses')
-rw-r--r--tests/responses/test_fileresponse.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/responses/test_fileresponse.py b/tests/responses/test_fileresponse.py
index 85350cd9f1..4e10105ce5 100644
--- a/tests/responses/test_fileresponse.py
+++ b/tests/responses/test_fileresponse.py
@@ -188,8 +188,9 @@ class FileResponseTests(SimpleTestCase):
pipe_for_write.write(b'binary content')
response = FileResponse(os.fdopen(pipe_for_read, mode='rb'))
- self.assertEqual(list(response), [b'binary content'])
+ response_content = list(response)
response.close()
+ self.assertEqual(response_content, [b'binary content'])
self.assertFalse(response.has_header('Content-Length'))
def test_compressed_response(self):