diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-16 08:54:14 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-16 08:54:14 (GMT) |
commit | 6a69466f6173adcebb1c6bb54c0e43b92d26eff7 (patch) | |
tree | 4dc15a0c1ddb4cb2db0cb29f50bb0fab20901591 /Lib/test/test_fileio.py | |
parent | f4bbc535b9f6fdd5f4c32e0e5518bea371dd51fa (diff) | |
download | cpython-6a69466f6173adcebb1c6bb54c0e43b92d26eff7.zip cpython-6a69466f6173adcebb1c6bb54c0e43b92d26eff7.tar.gz cpython-6a69466f6173adcebb1c6bb54c0e43b92d26eff7.tar.bz2 |
Backported tests from issue #20175.
Diffstat (limited to 'Lib/test/test_fileio.py')
-rw-r--r-- | Lib/test/test_fileio.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py index c37482e..fe5da69 100644 --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -126,9 +126,9 @@ class AutoFileTests(unittest.TestCase): 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'] self.f.close() self.assertTrue(self.f.closed) @@ -138,6 +138,15 @@ class AutoFileTests(unittest.TestCase): # 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 |