MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_copy_pickle

Method test_copy_pickle

Lib/test/test_exceptions.py:2115–2132  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2113 self.assertEqual(str(arg), str(exc))
2114
2115 def test_copy_pickle(self):
2116 for kwargs in (dict(),
2117 dict(name='somename'),
2118 dict(path='somepath'),
2119 dict(name='somename', path='somepath')):
2120 orig = ImportError('test', **kwargs)
2121 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
2122 exc = pickle.loads(pickle.dumps(orig, proto))
2123 self.assertEqual(exc.args, ('test',))
2124 self.assertEqual(exc.msg, 'test')
2125 self.assertEqual(exc.name, orig.name)
2126 self.assertEqual(exc.path, orig.path)
2127 for c in copy.copy, copy.deepcopy:
2128 exc = c(orig)
2129 self.assertEqual(exc.args, ('test',))
2130 self.assertEqual(exc.msg, 'test')
2131 self.assertEqual(exc.name, orig.name)
2132 self.assertEqual(exc.path, orig.path)
2133
2134
2135def run_script(source):

Callers

nothing calls this directly

Calls 4

cClass · 0.70
loadsMethod · 0.45
dumpsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected