diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-31 22:47:27 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-01-31 22:47:27 (GMT) |
commit | 905a2ffe3e5445925a669ab433521ddb66cf1043 (patch) | |
tree | f3a63e9771498b63eebb2797deaede3577695aaf /Lib/test/test_memoryio.py | |
parent | 9b661e6ef636bdd71639befc11e7ce71755f6421 (diff) | |
download | cpython-905a2ffe3e5445925a669ab433521ddb66cf1043.zip cpython-905a2ffe3e5445925a669ab433521ddb66cf1043.tar.gz cpython-905a2ffe3e5445925a669ab433521ddb66cf1043.tar.bz2 |
Merged revisions 77890 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r77890 | antoine.pitrou | 2010-01-31 23:26:04 +0100 (dim., 31 janv. 2010) | 7 lines
- Issue #6939: Fix file I/O objects in the `io` module to keep the original
file position when calling `truncate()`. It would previously change the
file position to the given argument, which goes against the tradition of
ftruncate() and other truncation APIs. Patch by Pascal Chambon.
........
Diffstat (limited to 'Lib/test/test_memoryio.py')
-rw-r--r-- | Lib/test/test_memoryio.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py index 9777631..99dfe6c 100644 --- a/Lib/test/test_memoryio.py +++ b/Lib/test/test_memoryio.py @@ -73,7 +73,7 @@ class MemoryTestMixin: self.assertEqual(f.seek(0), 0) self.assertEqual(f.write(t("h")), 1) self.assertEqual(f.truncate(12), 12) - self.assertEqual(f.tell(), 12) + self.assertEqual(f.tell(), 1) def test_write(self): buf = self.buftype("hello world\n") @@ -121,7 +121,8 @@ class MemoryTestMixin: self.assertEqual(memio.getvalue(), buf[:6]) self.assertEqual(memio.truncate(4), 4) self.assertEqual(memio.getvalue(), buf[:4]) - self.assertEqual(memio.tell(), 4) + self.assertEqual(memio.tell(), 6) + memio.seek(0, 2) memio.write(buf) self.assertEqual(memio.getvalue(), buf[:4] + buf) pos = memio.tell() |