Make a few more tests pass with the new I/O library.

Fix the truncate() semantics -- it should not affect the current position.
Switch wave.py/chunk.py to struct.unpack_from() to support bytes.
Don't use writelines() on binary files (test_fileinput.py).
This commit is contained in:
Guido van Rossum 2007-04-12 22:55:07 +00:00
parent b6f1fdc90c
commit dc0b1a1069
6 changed files with 16 additions and 20 deletions

View file

@ -93,7 +93,7 @@ class IOTest(unittest.TestCase):
self.assertEqual(f.seek(-1, 2), 13)
self.assertEqual(f.tell(), 13)
self.assertEqual(f.truncate(12), 12)
self.assertEqual(f.tell(), 12)
self.assertEqual(f.tell(), 13)
def read_ops(self, f, buffered=False):
data = f.read(5)
@ -135,7 +135,7 @@ class IOTest(unittest.TestCase):
self.assertEqual(f.tell(), self.LARGE + 2)
self.assertEqual(f.seek(0, 2), self.LARGE + 2)
self.assertEqual(f.truncate(self.LARGE + 1), self.LARGE + 1)
self.assertEqual(f.tell(), self.LARGE + 1)
self.assertEqual(f.tell(), self.LARGE + 2)
self.assertEqual(f.seek(0, 2), self.LARGE + 1)
self.assertEqual(f.seek(-1, 2), self.LARGE)
self.assertEqual(f.read(2), b"x")