summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-10-04 10:26:20 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-10-04 10:26:20 (GMT)
commit1e44fecc52da8fb47ab51a000c48e0ce8f36064c (patch)
tree402d41816f79d63ccfd1f8d296c0a4e6d3e32b1a /Lib/test/test_io.py
parent94190bb6e7f3b1c7942b562fe0fad3e62b5386b9 (diff)
downloadcpython-1e44fecc52da8fb47ab51a000c48e0ce8f36064c.zip
cpython-1e44fecc52da8fb47ab51a000c48e0ce8f36064c.tar.gz
cpython-1e44fecc52da8fb47ab51a000c48e0ce8f36064c.tar.bz2
Issue #13087: BufferedReader.seek() now always raises UnsupportedOperation
if the underlying raw stream is unseekable, even if the seek could be satisfied using the internal buffer. Patch by John O'Connor.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 0dc9d6d..53cabbb 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -922,6 +922,14 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
finally:
support.unlink(support.TESTFN)
+ def test_unseekable(self):
+ bufio = self.tp(self.MockUnseekableIO(b"A" * 10))
+ self.assertRaises(self.UnsupportedOperation, bufio.tell)
+ self.assertRaises(self.UnsupportedOperation, bufio.seek, 0)
+ bufio.read(1)
+ self.assertRaises(self.UnsupportedOperation, bufio.seek, 0)
+ self.assertRaises(self.UnsupportedOperation, bufio.tell)
+
def test_misbehaved_io(self):
rawio = self.MisbehavedRawIO((b"abc", b"d", b"efg"))
bufio = self.tp(rawio)