mirror of https://github.com/python/cpython
gh-99124: use concrete exception types in `test_builtin` (#99125)
This commit is contained in:
parent
d315722564
commit
c32bc1bffd
|
@ -159,7 +159,7 @@ class BuiltinTest(unittest.TestCase):
|
|||
__import__('string')
|
||||
__import__(name='sys')
|
||||
__import__(name='time', level=0)
|
||||
self.assertRaises(ImportError, __import__, 'spamspam')
|
||||
self.assertRaises(ModuleNotFoundError, __import__, 'spamspam')
|
||||
self.assertRaises(TypeError, __import__, 1, 2, 3, 4)
|
||||
self.assertRaises(ValueError, __import__, '')
|
||||
self.assertRaises(TypeError, __import__, 'sys', name='sys')
|
||||
|
@ -2380,7 +2380,7 @@ class TestType(unittest.TestCase):
|
|||
self.assertEqual(A.__module__, __name__)
|
||||
with self.assertRaises(ValueError):
|
||||
type('A\x00B', (), {})
|
||||
with self.assertRaises(ValueError):
|
||||
with self.assertRaises(UnicodeEncodeError):
|
||||
type('A\udcdcB', (), {})
|
||||
with self.assertRaises(TypeError):
|
||||
type(b'A', (), {})
|
||||
|
@ -2397,7 +2397,7 @@ class TestType(unittest.TestCase):
|
|||
with self.assertRaises(ValueError):
|
||||
A.__name__ = 'A\x00B'
|
||||
self.assertEqual(A.__name__, 'C')
|
||||
with self.assertRaises(ValueError):
|
||||
with self.assertRaises(UnicodeEncodeError):
|
||||
A.__name__ = 'A\udcdcB'
|
||||
self.assertEqual(A.__name__, 'C')
|
||||
with self.assertRaises(TypeError):
|
||||
|
|
Loading…
Reference in New Issue