mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Backported tests from issue #20175.
This commit is contained in:
parent
f4bbc535b9
commit
6a69466f61
2 changed files with 23 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue