File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -689,6 +689,23 @@ def test_write_sequential(self):
689
689
f .write ('x' )
690
690
self .assertTrue (f ._rolled )
691
691
692
+ def test_writelines (self ):
693
+ # Verify writelines with a SpooledTemporaryFile
694
+ f = self .do_create ()
695
+ f .writelines ((b'x' , b'y' , b'z' ))
696
+ f .seek (0 )
697
+ buf = f .read ()
698
+ self .assertEqual (buf , b'xyz' )
699
+
700
+ def test_writelines_sequential (self ):
701
+ # A SpooledTemporaryFile should hold exactly max_size bytes, and roll
702
+ # over afterward
703
+ f = self .do_create (max_size = 35 )
704
+ f .writelines ((b'x' * 20 , b'x' * 10 , b'x' * 5 ))
705
+ self .assertFalse (f ._rolled )
706
+ f .write (b'x' )
707
+ self .assertTrue (f ._rolled )
708
+
692
709
def test_sparse (self ):
693
710
# A SpooledTemporaryFile that is written late in the file will extend
694
711
# when that occurs
Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ Brian Curtin
182
182
Lisandro Dalcin
183
183
Andrew Dalke
184
184
Lars Damerow
185
+ Evan Dandrea
185
186
Eric Daniel
186
187
Scott David Daniels
187
188
Ben Darnell
You can’t perform that action at this time.
0 commit comments