summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_io.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-03-09 00:07:03 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-03-09 00:07:03 (GMT)
commitc4c0eaebbff47a70bcdbc97d9b57e57b977efb5d (patch)
treeee6ed5cd1fc352607a41a9acffef867e5aa5bf51 /Lib/test/test_io.py
parentf2b55fb5ee0374babd770dd5aabad5045a1f78dc (diff)
downloadcpython-c4c0eaebbff47a70bcdbc97d9b57e57b977efb5d.zip
cpython-c4c0eaebbff47a70bcdbc97d9b57e57b977efb5d.tar.gz
cpython-c4c0eaebbff47a70bcdbc97d9b57e57b977efb5d.tar.bz2
give TextIOWrapper a repr that tells you the encoding
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r--Lib/test/test_io.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index 5fc53ea..ef3fed9 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -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)