File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -697,6 +697,23 @@ def test_write_sequential(self):
697697 f .write (b'x' )
698698 self .assertTrue (f ._rolled )
699699
700+ def test_writelines (self ):
701+ # Verify writelines with a SpooledTemporaryFile
702+ f = self .do_create ()
703+ f .writelines ((b'x' , b'y' , b'z' ))
704+ f .seek (0 )
705+ buf = f .read ()
706+ self .assertEqual (buf , b'xyz' )
707+
708+ def test_writelines_sequential (self ):
709+ # A SpooledTemporaryFile should hold exactly max_size bytes, and roll
710+ # over afterward
711+ f = self .do_create (max_size = 35 )
712+ f .writelines ((b'x' * 20 , b'x' * 10 , b'x' * 5 ))
713+ self .assertFalse (f ._rolled )
714+ f .write (b'x' )
715+ self .assertTrue (f ._rolled )
716+
700717 def test_sparse (self ):
701718 # A SpooledTemporaryFile that is written late in the file will extend
702719 # when that occurs
Original file line number Diff line number Diff line change @@ -176,6 +176,7 @@ Tom Culliton
176176Lisandro Dalcin
177177Andrew Dalke
178178Lars Damerow
179+ Evan Dandrea
179180Eric Daniel
180181Scott David Daniels
181182Ben Darnell
You can’t perform that action at this time.
0 commit comments