summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-03-14 13:57:03 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-03-14 13:57:03 (GMT)
commit1a5201f80d2293cd5ab83f4f3a751fb508f64ea7 (patch)
treeb08630b6ecae68f9aed42ca954e8cb32d06caa09
parent13312638b37dfdc725260d49df6402bfe70c9fc7 (diff)
parentd89ee79d19e156e874b7a292b705d167b7fe56ab (diff)
downloadcpython-1a5201f80d2293cd5ab83f4f3a751fb508f64ea7.zip
cpython-1a5201f80d2293cd5ab83f4f3a751fb508f64ea7.tar.gz
cpython-1a5201f80d2293cd5ab83f4f3a751fb508f64ea7.tar.bz2
Merge #11488 patch from 3.1.
-rw-r--r--Lib/test/test_tempfile.py17
-rw-r--r--Misc/ACKS1
2 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_tempfile.py b/Lib/test/test_tempfile.py
index cf8fc33..2d29885 100644
--- a/Lib/test/test_tempfile.py
+++ b/Lib/test/test_tempfile.py
@@ -704,6 +704,23 @@ class test_SpooledTemporaryFile(TC):
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
index 02882c6..d507ade 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -196,6 +196,7 @@ Brian Curtin
Lisandro Dalcin
Andrew Dalke
Lars Damerow
+Evan Dandrea
Eric Daniel
Scott David Daniels
Ben Darnell