diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-16 08:56:35 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-16 08:56:35 (GMT) |
commit | abb7e6504291506fee695ad56a642d0dea6370e4 (patch) | |
tree | be68007bd9263eda19ff72cc834f34f67b823bf8 /Lib/test/test_io.py | |
parent | 6d12c80c91f4bad809a610fe8df03c1b1e65c9fa (diff) | |
download | cpython-abb7e6504291506fee695ad56a642d0dea6370e4.zip cpython-abb7e6504291506fee695ad56a642d0dea6370e4.tar.gz cpython-abb7e6504291506fee695ad56a642d0dea6370e4.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 2914a80..bbc804b 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -1990,6 +1990,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.assertRaisesRegexp((ValueError, AttributeError), + 'uninitialized|has no attribute', + t.read, 0) + t.__init__(self.MockRawIO()) + self.assertEqual(t.read(0), u'') + def test_detach(self): r = self.BytesIO() b = self.BufferedWriter(r) |