mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #29188 -- Fixed ContentFile.size after a write().
This commit is contained in:
@@ -206,6 +206,16 @@ class ContentFileTestCase(unittest.TestCase):
|
||||
with file.open() as f:
|
||||
self.assertEqual(f.read(), b'content')
|
||||
|
||||
def test_size_changing_after_writing(self):
|
||||
"""ContentFile.size changes after a write()."""
|
||||
f = ContentFile('')
|
||||
self.assertEqual(f.size, 0)
|
||||
f.write('Test ')
|
||||
f.write('string')
|
||||
self.assertEqual(f.size, 11)
|
||||
with f.open() as fh:
|
||||
self.assertEqual(fh.read(), 'Test string')
|
||||
|
||||
|
||||
class InMemoryUploadedFileTests(unittest.TestCase):
|
||||
def test_open_resets_file_to_start_and_returns_context_manager(self):
|
||||
|
||||
Reference in New Issue
Block a user