diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-01 20:40:59 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-01 20:40:59 (GMT) |
commit | d2e0c7955f972c8477260e8d9799dd45acd4607b (patch) | |
tree | 1b6ac51c7efa6425c0da52b22ad88163029935b3 /Lib/test/test_memoryio.py | |
parent | 155374d95d8ecd235d3a3edd92dd6f6a23d59f11 (diff) | |
download | cpython-d2e0c7955f972c8477260e8d9799dd45acd4607b.zip cpython-d2e0c7955f972c8477260e8d9799dd45acd4607b.tar.gz cpython-d2e0c7955f972c8477260e8d9799dd45acd4607b.tar.bz2 |
implement a detach() method for BufferedIOBase and TextIOBase #5883
Diffstat (limited to 'Lib/test/test_memoryio.py')
-rw-r--r-- | Lib/test/test_memoryio.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py index ad04613..d94d9dd 100644 --- a/Lib/test/test_memoryio.py +++ b/Lib/test/test_memoryio.py @@ -57,6 +57,10 @@ class MemorySeekTestMixin: class MemoryTestMixin: + def test_detach(self): + buf = self.ioclass() + self.assertRaises(self.UnsupportedOperation, buf.detach) + def write_ops(self, f, t): self.assertEqual(f.write(t("blah.")), 5) self.assertEqual(f.seek(0), 0) @@ -336,6 +340,9 @@ class MemoryTestMixin: class PyBytesIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): + + UnsupportedOperation = pyio.UnsupportedOperation + @staticmethod def buftype(s): return s.encode("ascii") @@ -413,6 +420,7 @@ class PyBytesIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): buftype = str ioclass = pyio.StringIO + UnsupportedOperation = pyio.UnsupportedOperation EOF = "" # TextIO-specific behaviour. @@ -518,9 +526,11 @@ class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): class CBytesIOTest(PyBytesIOTest): ioclass = io.BytesIO + UnsupportedOperation = io.UnsupportedOperation class CStringIOTest(PyStringIOTest): ioclass = io.StringIO + UnsupportedOperation = io.UnsupportedOperation # XXX: For the Python version of io.StringIO, this is highly # dependent on the encoding used for the underlying buffer. |