summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-16 08:19:43 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-16 08:19:43 (GMT)
commitf24131ff3125e59ca779d0e2fcec4967d50f950c (patch)
treec870dd7568c6bdf0b8340e282ced5205c71ee618 /Lib/test/test_io.py
parent7f90cba7f3f2ebd7eb5e614917014760f61c6ec8 (diff)
downloadcpython-f24131ff3125e59ca779d0e2fcec4967d50f950c.zip
cpython-f24131ff3125e59ca779d0e2fcec4967d50f950c.tar.gz
cpython-f24131ff3125e59ca779d0e2fcec4967d50f950c.tar.bz2
Issue #20175: Converted the _io module to Argument Clinic.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 02f7427..5b7cfc9 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -2163,6 +2163,17 @@ class TextIOWrapperTest(unittest.TestCase):
self.assertRaises(TypeError, t.__init__, b, newline=42)
self.assertRaises(ValueError, t.__init__, b, newline='xyzzy')
+ def test_uninitialized(self):
+ t = self.TextIOWrapper.__new__(self.TextIOWrapper)
+ del t
+ t = self.TextIOWrapper.__new__(self.TextIOWrapper)
+ self.assertRaises(Exception, repr, t)
+ self.assertRaisesRegex((ValueError, AttributeError),
+ 'uninitialized|has no attribute',
+ t.read, 0)
+ t.__init__(self.MockRawIO())
+ self.assertEqual(t.read(0), '')
+
def test_non_text_encoding_codecs_are_rejected(self):
# Ensure the constructor complains if passed a codec that isn't
# marked as a text encoding
@@ -3024,8 +3035,6 @@ class CTextIOWrapperTest(TextIOWrapperTest):
r = self.BytesIO(b"\xc3\xa9\n\n")
b = self.BufferedReader(r, 1000)
t = self.TextIOWrapper(b)
- self.assertRaises(TypeError, t.__init__, b, newline=42)
- self.assertRaises(ValueError, t.read)
self.assertRaises(ValueError, t.__init__, b, newline='xyzzy')
self.assertRaises(ValueError, t.read)