summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2016-09-07 22:42:32 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2016-09-07 22:42:32 (GMT)
commitc943265ba56e7ce7e2fe79fdecfc6670e10e5467 (patch)
tree3447a25e48844f57e2e8452aad43a3567101cd32 /Lib/test
parent86a76684269f940a20366cb42668f1acb0982dca (diff)
downloadcpython-c943265ba56e7ce7e2fe79fdecfc6670e10e5467.zip
cpython-c943265ba56e7ce7e2fe79fdecfc6670e10e5467.tar.gz
cpython-c943265ba56e7ce7e2fe79fdecfc6670e10e5467.tar.bz2
Issue #15767: Add ModuleNotFoundError.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/exception_hierarchy.txt1
-rw-r--r--Lib/test/test_pickle.py8
2 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/exception_hierarchy.txt b/Lib/test/exception_hierarchy.txt
index 0513765..7333b2a 100644
--- a/Lib/test/exception_hierarchy.txt
+++ b/Lib/test/exception_hierarchy.txt
@@ -14,6 +14,7 @@ BaseException
+-- BufferError
+-- EOFError
+-- ImportError
+ +-- ModuleNotFoundError
+-- LookupError
| +-- IndexError
| +-- KeyError
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index 05203e5..e6c5d08 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -335,6 +335,9 @@ class CompatPickleTests(unittest.TestCase):
if (module2, name2) == ('exceptions', 'OSError'):
attr = getattribute(module3, name3)
self.assertTrue(issubclass(attr, OSError))
+ elif (module2, name2) == ('exceptions', 'ImportError'):
+ attr = getattribute(module3, name3)
+ self.assertTrue(issubclass(attr, ImportError))
else:
module, name = mapping(module2, name2)
if module3[:1] != '_':
@@ -401,6 +404,11 @@ class CompatPickleTests(unittest.TestCase):
if exc is not OSError and issubclass(exc, OSError):
self.assertEqual(reverse_mapping('builtins', name),
('exceptions', 'OSError'))
+ elif exc is not ImportError and issubclass(exc, ImportError):
+ self.assertEqual(reverse_mapping('builtins', name),
+ ('exceptions', 'ImportError'))
+ self.assertEqual(mapping('exceptions', name),
+ ('exceptions', name))
else:
self.assertEqual(reverse_mapping('builtins', name),
('exceptions', name))