]> granicus.if.org Git - python/commitdiff
Port #11488 patch from 3.1 (changeset f816841bab03)
authorR David Murray <rdmurray@bitdance.com>
Mon, 14 Mar 2011 14:01:12 +0000 (10:01 -0400)
committerR David Murray <rdmurray@bitdance.com>
Mon, 14 Mar 2011 14:01:12 +0000 (10:01 -0400)
Lib/test/test_tempfile.py
Misc/ACKS

index 27068e3295a0d23874d121d6657b3e5905a0d7d6..b50214a75afa133fdfaedab5166150ea6cd6b3fc 100644 (file)
@@ -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
index 9ec0fc9239fc62f0d4a90a8d389db7668bbba088..5a7b8a6b11a7a29411cc29cd0a0fba1265813954 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -182,6 +182,7 @@ Brian Curtin
 Lisandro Dalcin
 Andrew Dalke
 Lars Damerow
+Evan Dandrea
 Eric Daniel
 Scott David Daniels
 Ben Darnell