summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fileio.py
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2014-10-18 00:32:43 (GMT)
committerRobert Collins <rbtcollins@hp.com>2014-10-18 00:32:43 (GMT)
commit933430ab69b051aa35130a3cf779528faca9b6f2 (patch)
treedf0df6807ba2f82cc56d034c54226a5f2628abc9 /Lib/test/test_fileio.py
parentd20ec1b92196a01acf9bfb990329d06b4dee5c78 (diff)
downloadcpython-933430ab69b051aa35130a3cf779528faca9b6f2.zip
cpython-933430ab69b051aa35130a3cf779528faca9b6f2.tar.gz
cpython-933430ab69b051aa35130a3cf779528faca9b6f2.tar.bz2
Issue #17401: document closefd in io.FileIO docs and add to repr
closefd was documented in the open docs but not the matching FileIO class documented. Further, closefd, part of the core state for the object was not shown. In review it was noted that the open docs are a little confusing about the interaction between closefd and paths, so tweaked them at the same time.
Diffstat (limited to 'Lib/test/test_fileio.py')
-rw-r--r--Lib/test/test_fileio.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 41be95e..7c1a5ce 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -112,11 +112,13 @@ class AutoFileTests(unittest.TestCase):
self.assertRaises(TypeError, self.f.write, "Hello!")
def testRepr(self):
- self.assertEqual(repr(self.f), "<_io.FileIO name=%r mode=%r>"
- % (self.f.name, self.f.mode))
+ self.assertEqual(
+ repr(self.f), "<_io.FileIO name=%r mode=%r closefd='%d'>"
+ % (self.f.name, self.f.mode, self.f.closefd))
del self.f.name
- self.assertEqual(repr(self.f), "<_io.FileIO fd=%r mode=%r>"
- % (self.f.fileno(), self.f.mode))
+ self.assertEqual(
+ repr(self.f), "<_io.FileIO fd=%r mode=%r closefd='%d'>"
+ % (self.f.fileno(), self.f.mode, self.f.closefd))
self.f.close()
self.assertEqual(repr(self.f), "<_io.FileIO [closed]>")