diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-04 10:28:52 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-10-04 10:28:52 (GMT) |
commit | bf009f0bceb9057a44e30b1b397163663ec69634 (patch) | |
tree | d89e05dcf2c20ee6bd1b76ffa7d869f1949d52d3 /Lib/test/test_io.py | |
parent | 5b99df68b08dc992a1b0b7784ce9f5410ecb8028 (diff) | |
parent | 0fc80c0d5a76ed59f3db0b3f15e1e37ccc127ffb (diff) | |
download | cpython-bf009f0bceb9057a44e30b1b397163663ec69634.zip cpython-bf009f0bceb9057a44e30b1b397163663ec69634.tar.gz cpython-bf009f0bceb9057a44e30b1b397163663ec69634.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 OConnor.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 117f8ab..455eda3 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -928,6 +928,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) |