diff options
| author | Alex Stovbur <alexstovbur@redwerk.com> | 2018-03-07 23:20:25 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-03-08 14:07:29 -0500 |
| commit | 2d9ec4d735871b44c7a05d6e0aa3f92763f667f5 (patch) | |
| tree | 0600bef53adef2c218b86a22316381900ca9998b /tests/files | |
| parent | 277ed072094ad87fc6b2c4669f21d43b1f39043c (diff) | |
Fixed #29188 -- Fixed ContentFile.size after a write().
Diffstat (limited to 'tests/files')
| -rw-r--r-- | tests/files/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/files/tests.py b/tests/files/tests.py index 3999794154..663d2d976f 100644 --- a/tests/files/tests.py +++ b/tests/files/tests.py @@ -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): |
