We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0dc71e2 commit 751c78fCopy full SHA for 751c78f
Lib/test/test_tempfile.py
@@ -1288,6 +1288,18 @@ def test_writelines(self):
1288
buf = f.read()
1289
self.assertEqual(buf, b'xyz')
1290
1291
+ def test_writelines_rollover(self):
1292
+ # Verify writelines rolls over before exhausting the iterator
1293
+ f = self.do_create(max_size=2)
1294
+
1295
+ def it():
1296
+ yield b'xy'
1297
+ self.assertFalse(f._rolled)
1298
+ yield b'z'
1299
+ self.assertTrue(f._rolled)
1300
1301
+ f.writelines(it())
1302
1303
def test_writelines_sequential(self):
1304
# A SpooledTemporaryFile should hold exactly max_size bytes, and roll
1305
# over afterward
0 commit comments