diff options
| author | R David Murray <rdmurray@bitdance.com> | 2011-03-14 14:01:12 (GMT) |
|---|---|---|
| committer | R David Murray <rdmurray@bitdance.com> | 2011-03-14 14:01:12 (GMT) |
| commit | b44e1841d504269f01250949fc97e98ccd0ba8a2 (patch) | |
| tree | caf6785925edd92146dda243331b9fa2d6664593 /Lib/test/test_tempfile.py | |
| parent | a3ed3f03d75c416010da73bc4d5ad1e3e8f28d19 (diff) | |
| download | cpython-b44e1841d504269f01250949fc97e98ccd0ba8a2.zip cpython-b44e1841d504269f01250949fc97e98ccd0ba8a2.tar.gz cpython-b44e1841d504269f01250949fc97e98ccd0ba8a2.tar.bz2 | |
Port #11488 patch from 3.1 (changeset f816841bab03)
Diffstat (limited to 'Lib/test/test_tempfile.py')
| -rw-r--r-- | Lib/test/test_tempfile.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py index 27068e3..b50214a 100644 --- a/Lib/test/test_tempfile.py +++ b/Lib/test/test_tempfile.py @@ -689,6 +689,23 @@ class test_SpooledTemporaryFile(TC): f.write('x') self.assertTrue(f._rolled) + def test_writelines(self): + # Verify writelines with a SpooledTemporaryFile + f = self.do_create() + f.writelines((b'x', b'y', b'z')) + f.seek(0) + buf = f.read() + self.assertEqual(buf, b'xyz') + + def test_writelines_sequential(self): + # A SpooledTemporaryFile should hold exactly max_size bytes, and roll + # over afterward + f = self.do_create(max_size=35) + f.writelines((b'x' * 20, b'x' * 10, b'x' * 5)) + self.assertFalse(f._rolled) + f.write(b'x') + self.assertTrue(f._rolled) + def test_sparse(self): # A SpooledTemporaryFile that is written late in the file will extend # when that occurs |
