mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
give TextIOWrapper a repr that tells you the encoding
This commit is contained in:
parent
f2b55fb5ee
commit
c4c0eaebbf
3 changed files with 19 additions and 2 deletions
|
@ -1354,6 +1354,12 @@ class TextIOWrapperTest(unittest.TestCase):
|
|||
self.assertRaises(TypeError, t.__init__, b, newline=42)
|
||||
self.assertRaises(ValueError, t.__init__, b, newline='xyzzy')
|
||||
|
||||
def test_repr(self):
|
||||
raw = self.BytesIO("hello".encode("utf-8"))
|
||||
b = self.BufferedReader(raw)
|
||||
t = self.TextIOWrapper(b, encoding="utf-8")
|
||||
self.assertEqual(repr(t), "<TextIOWrapper encoding=utf-8>")
|
||||
|
||||
def test_line_buffering(self):
|
||||
r = self.BytesIO()
|
||||
b = self.BufferedWriter(r, 1000)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue