mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Replace IOError with OSError (#16715)
This commit is contained in:
parent
16bdd4120d
commit
f7a17b48d7
121 changed files with 381 additions and 386 deletions
|
@ -87,7 +87,7 @@ class AutoFileTests(unittest.TestCase):
|
|||
self.assertTrue(not f.closed)
|
||||
|
||||
if hasattr(f, "readinto"):
|
||||
self.assertRaises((IOError, TypeError), f.readinto, "")
|
||||
self.assertRaises((OSError, TypeError), f.readinto, "")
|
||||
f.close()
|
||||
self.assertTrue(f.closed)
|
||||
|
||||
|
@ -126,7 +126,7 @@ class AutoFileTests(unittest.TestCase):
|
|||
self.assertEqual(self.f.__exit__(*sys.exc_info()), None)
|
||||
|
||||
def testReadWhenWriting(self):
|
||||
self.assertRaises(IOError, self.f.read)
|
||||
self.assertRaises(OSError, self.f.read)
|
||||
|
||||
class CAutoFileTests(AutoFileTests):
|
||||
open = io.open
|
||||
|
@ -151,12 +151,12 @@ class OtherFileTests(unittest.TestCase):
|
|||
def testStdin(self):
|
||||
# This causes the interpreter to exit on OSF1 v5.1.
|
||||
if sys.platform != 'osf1V5':
|
||||
self.assertRaises((IOError, ValueError), sys.stdin.seek, -1)
|
||||
self.assertRaises((OSError, ValueError), sys.stdin.seek, -1)
|
||||
else:
|
||||
print((
|
||||
' Skipping sys.stdin.seek(-1), it may crash the interpreter.'
|
||||
' Test manually.'), file=sys.__stdout__)
|
||||
self.assertRaises((IOError, ValueError), sys.stdin.truncate)
|
||||
self.assertRaises((OSError, ValueError), sys.stdin.truncate)
|
||||
|
||||
def testBadModeArgument(self):
|
||||
# verify that we get a sensible error message for bad mode argument
|
||||
|
@ -187,7 +187,7 @@ class OtherFileTests(unittest.TestCase):
|
|||
d = int(f.read().decode("ascii"))
|
||||
f.close()
|
||||
f.close()
|
||||
except IOError as msg:
|
||||
except OSError as msg:
|
||||
self.fail('error setting buffer size %d: %s' % (s, str(msg)))
|
||||
self.assertEqual(d, s)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue