Issue #10872: The repr() of TextIOWrapper objects now includes the mode
if available.
(at Georg's request)
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py
index ee4e42f..a25d9af 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -1717,9 +1717,12 @@
raw.name = "dummy"
self.assertEqual(repr(t),
"<%s.TextIOWrapper name='dummy' encoding='utf-8'>" % modname)
+ t.mode = "r"
+ self.assertEqual(repr(t),
+ "<%s.TextIOWrapper name='dummy' mode='r' encoding='utf-8'>" % modname)
raw.name = b"dummy"
self.assertEqual(repr(t),
- "<%s.TextIOWrapper name=b'dummy' encoding='utf-8'>" % modname)
+ "<%s.TextIOWrapper name=b'dummy' mode='r' encoding='utf-8'>" % modname)
def test_line_buffering(self):
r = self.BytesIO()