Backported tests from issue #20175.
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index b45d79b..e21e47f 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -125,9 +125,9 @@
self.assertTrue(f.closed)
def testMethods(self):
- methods = ['fileno', 'isatty', 'read', 'readinto',
- 'seek', 'tell', 'truncate', 'write', 'seekable',
- 'readable', 'writable']
+ methods = ['fileno', 'isatty', 'seekable', 'readable', 'writable',
+ 'read', 'readall', 'readline', 'readlines',
+ 'tell', 'truncate', 'flush']
if sys.platform.startswith('atheos'):
methods.remove('truncate')
@@ -139,6 +139,15 @@
# should raise on closed file
self.assertRaises(ValueError, method)
+ self.assertRaises(ValueError, self.f.readinto) # XXX should be TypeError?
+ self.assertRaises(ValueError, self.f.readinto, bytearray(1))
+ self.assertRaises(ValueError, self.f.seek)
+ self.assertRaises(ValueError, self.f.seek, 0)
+ self.assertRaises(ValueError, self.f.write)
+ self.assertRaises(ValueError, self.f.write, b'')
+ self.assertRaises(TypeError, self.f.writelines)
+ self.assertRaises(ValueError, self.f.writelines, b'')
+
def testOpendir(self):
# Issue 3703: opening a directory should fill the errno
# Windows always returns "[Errno 13]: Permission denied