summaryrefslogtreecommitdiff
path: root/Lib/test/test_largefile.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-01-31 22:26:04 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-01-31 22:26:04 +0000
commitf3fa07470381b4f54b2d3f911fc22624e9b0b27d (patch)
tree5368b993641d34b3824a79896bf18c8f9097ce5c /Lib/test/test_largefile.py
parente70c72c06b169a36170ab68ec52bda9a87c16274 (diff)
downloadcpython-git-f3fa07470381b4f54b2d3f911fc22624e9b0b27d.tar.gz
- 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_largefile.py')
-rw-r--r--Lib/test/test_largefile.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py
index c4faeada21..16da8d8f17 100644
--- a/Lib/test/test_largefile.py
+++ b/Lib/test/test_largefile.py
@@ -125,7 +125,7 @@ class LargeFileTest(unittest.TestCase):
f.seek(42)
f.truncate(newsize)
if self.new_io:
- self.assertEqual(f.tell(), newsize) # else wasn't truncated
+ self.assertEqual(f.tell(), 42)
f.seek(0, 2)
self.assertEqual(f.tell(), newsize)
# XXX truncate(larger than true size) is ill-defined
@@ -133,7 +133,7 @@ class LargeFileTest(unittest.TestCase):
f.seek(0)
f.truncate(1)
if self.new_io:
- self.assertEqual(f.tell(), 1) # else pointer moved
+ self.assertEqual(f.tell(), 0) # else pointer moved
f.seek(0)
self.assertEqual(len(f.read()), 1) # else wasn't truncated