summaryrefslogtreecommitdiff
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-12-21 21:26:09 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-12-21 21:26:09 +0000
commit6cfc5124f2a615922d32ac19a319ffab8edaad0f (patch)
tree1d6b68e8021f9e1e10d7b32fad7708e39f4b30de /Lib/test/test_io.py
parent9fc6b6c4536417283c6f52b6dfb4c82afb372448 (diff)
downloadcpython-git-6cfc5124f2a615922d32ac19a319ffab8edaad0f.tar.gz
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. ........
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index ab8479d3a6..5f62494e63 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -693,6 +693,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):
+ buf.raw = x
+
class BufferedReaderTest(unittest.TestCase, CommonBufferedTests):
read_mode = "rb"
@@ -2210,6 +2217,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):
+ txt.buffer = buf
+
class CTextIOWrapperTest(TextIOWrapperTest):
def test_initialization(self):