[Python-checkins] cpython (merge 3.2 -> default): Merge #11488 patch from 3.2.

r.david.murray python-checkins at python.org
Mon Mar 14 15:01:47 CET 2011


http://hg.python.org/cpython/rev/7942f613ea5c
changeset:   68445:7942f613ea5c
parent:      68441:a49bda5ff3d5
parent:      68444:da37cc4bd088
user:        R David Murray <rdmurray at bitdance.com>
date:        Mon Mar 14 09:58:59 2011 -0400
summary:
  Merge #11488 patch from 3.2.

files:
  Misc/ACKS

diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -704,6 +704,23 @@
         f.write(b'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
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -197,6 +197,7 @@
 Lisandro Dalcin
 Andrew Dalke
 Lars Damerow
+Evan Dandrea
 Eric Daniel
 Scott David Daniels
 Ben Darnell

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list