summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-11-08 02:12:48 (GMT)
committerGitHub <noreply@github.com>2022-11-08 02:12:48 (GMT)
commit42fb233c52f438b42666d3d09937ea8130f93d6c (patch)
tree2a740ab61aa3642d808d336082f18bda5c49125e
parent1e5e38b0ee45f0ebb04d7c24b4abce9f6f6e877e (diff)
downloadcpython-42fb233c52f438b42666d3d09937ea8130f93d6c.zip
cpython-42fb233c52f438b42666d3d09937ea8130f93d6c.tar.gz
cpython-42fb233c52f438b42666d3d09937ea8130f93d6c.tar.bz2
gh-99124: use concrete exception types in `test_builtin` (GH-99125)
(cherry picked from commit c32bc1bffd9d63ede0d0505abab983247a3ad0c6) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r--Lib/test/test_builtin.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index 4cc9315..6cd72ed 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -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')
@@ -2376,7 +2376,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', (), {})
@@ -2393,7 +2393,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):