MCPcopy Index your code
hub / github.com/python/cpython / test_exceptions

Method test_exceptions

Lib/test/test_pickle.py:708–744  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

706 self.assertEqual((module, name), (module3, name3))
707
708 def test_exceptions(self):
709 self.assertEqual(mapping('exceptions', 'StandardError'),
710 ('builtins', 'Exception'))
711 self.assertEqual(mapping('exceptions', 'Exception'),
712 ('builtins', 'Exception'))
713 self.assertEqual(reverse_mapping('builtins', 'Exception'),
714 ('exceptions', 'Exception'))
715 self.assertEqual(mapping('exceptions', 'OSError'),
716 ('builtins', 'OSError'))
717 self.assertEqual(reverse_mapping('builtins', 'OSError'),
718 ('exceptions', 'OSError'))
719
720 for name, exc in get_exceptions(builtins):
721 with self.subTest(name):
722 if exc in (BlockingIOError,
723 ResourceWarning,
724 StopAsyncIteration,
725 PythonFinalizationError,
726 RecursionError,
727 EncodingWarning,
728 BaseExceptionGroup,
729 ExceptionGroup,
730 _IncompleteInputError):
731 continue
732 if exc is not OSError and issubclass(exc, OSError):
733 self.assertEqual(reverse_mapping('builtins', name),
734 ('exceptions', 'OSError'))
735 elif exc is not ImportError and issubclass(exc, ImportError):
736 self.assertEqual(reverse_mapping('builtins', name),
737 ('exceptions', 'ImportError'))
738 self.assertEqual(mapping('exceptions', name),
739 ('exceptions', name))
740 else:
741 self.assertEqual(reverse_mapping('builtins', name),
742 ('exceptions', name))
743 self.assertEqual(mapping('exceptions', name),
744 ('builtins', name))
745
746 def test_multiprocessing_exceptions(self):
747 module = import_helper.import_module('multiprocessing.context')

Callers

nothing calls this directly

Calls 5

mappingFunction · 0.85
reverse_mappingFunction · 0.85
get_exceptionsFunction · 0.85
assertEqualMethod · 0.45
subTestMethod · 0.45

Tested by

no test coverage detected