diff options
author | Guido van Rossum <guido@python.org> | 2007-04-12 22:55:07 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-04-12 22:55:07 (GMT) |
commit | dc0b1a106981ee204936221f4e0863bd1d7a6ba6 (patch) | |
tree | 102949af2918a30ac4da920751e994c0df4af702 /Lib/test | |
parent | b6f1fdc90ca1f5826c5bd8e015a37563923144b5 (diff) | |
download | cpython-dc0b1a106981ee204936221f4e0863bd1d7a6ba6.zip cpython-dc0b1a106981ee204936221f4e0863bd1d7a6ba6.tar.gz cpython-dc0b1a106981ee204936221f4e0863bd1d7a6ba6.tar.bz2 |
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).
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_fileinput.py | 3 | ||||
-rw-r--r-- | Lib/test/test_io.py | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_fileinput.py b/Lib/test/test_fileinput.py index 2b7b255..b7f84c6 100644 --- a/Lib/test/test_fileinput.py +++ b/Lib/test/test_fileinput.py @@ -18,7 +18,8 @@ from fileinput import FileInput, hook_encoded def writeTmp(i, lines, mode='w'): # opening in text mode is the default name = TESTFN + str(i) f = open(name, mode) - f.writelines(lines) + for line in lines: + f.write(line) f.close() return name diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 737dfab..1f6be02 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -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") |