mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Merged revisions 87427 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87427 | antoine.pitrou | 2010-12-21 22:20:59 +0100 (mar., 21 déc. 2010) | 3 lines Issue #10750: The `raw` attribute of buffered IO objects is now read-only. ........
This commit is contained in:
parent
5cf3672999
commit
fc9ead69e5
4 changed files with 32 additions and 9 deletions
|
@ -701,6 +701,13 @@ class CommonBufferedTests:
|
|||
b.close()
|
||||
self.assertRaises(ValueError, b.flush)
|
||||
|
||||
def test_readonly_attributes(self):
|
||||
raw = self.MockRawIO()
|
||||
buf = self.tp(raw)
|
||||
x = self.MockRawIO()
|
||||
with self.assertRaises((AttributeError, TypeError)):
|
||||
buf.raw = x
|
||||
|
||||
|
||||
class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
|
||||
read_mode = "rb"
|
||||
|
@ -2211,6 +2218,12 @@ class TextIOWrapperTest(unittest.TestCase):
|
|||
txt.close()
|
||||
self.assertRaises(ValueError, txt.flush)
|
||||
|
||||
def test_readonly_attributes(self):
|
||||
txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii")
|
||||
buf = self.BytesIO(self.testdata)
|
||||
with self.assertRaises((AttributeError, TypeError)):
|
||||
txt.buffer = buf
|
||||
|
||||
class CTextIOWrapperTest(TextIOWrapperTest):
|
||||
|
||||
def test_initialization(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue