diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-16 08:54:14 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-16 08:54:14 (GMT) |
commit | 6a69466f6173adcebb1c6bb54c0e43b92d26eff7 (patch) | |
tree | 4dc15a0c1ddb4cb2db0cb29f50bb0fab20901591 /Lib/test/test_io.py | |
parent | f4bbc535b9f6fdd5f4c32e0e5518bea371dd51fa (diff) | |
download | cpython-6a69466f6173adcebb1c6bb54c0e43b92d26eff7.zip cpython-6a69466f6173adcebb1c6bb54c0e43b92d26eff7.tar.gz cpython-6a69466f6173adcebb1c6bb54c0e43b92d26eff7.tar.bz2 |
Backported tests from issue #20175.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index ea109ac..2fb1b1e 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2087,6 +2087,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 |