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

Method assert_is_copy

Lib/test/pickletester.py:838–854  ·  view source on GitHub ↗

Utility method to verify if two objects are copies of each others.

(self, obj, objcopy, msg=None)

Source from the content-addressed store, hash-verified

836 _testdata = create_data()
837
838 def assert_is_copy(self, obj, objcopy, msg=None):
839 """Utility method to verify if two objects are copies of each others.
840 """
841 if msg is None:
842 msg = "{!r} is not a copy of {!r}".format(obj, objcopy)
843 self.assertEqual(obj, objcopy, msg=msg)
844 self.assertIs(type(obj), type(objcopy), msg=msg)
845 if hasattr(obj, '__dict__'):
846 self.assertDictEqual(obj.__dict__, objcopy.__dict__, msg=msg)
847 self.assertIsNot(obj.__dict__, objcopy.__dict__, msg=msg)
848 if hasattr(obj, '__slots__'):
849 self.assertListEqual(obj.__slots__, objcopy.__slots__, msg=msg)
850 for slot in obj.__slots__:
851 self.assertEqual(
852 hasattr(obj, slot), hasattr(objcopy, slot), msg=msg)
853 self.assertEqual(getattr(obj, slot, None),
854 getattr(objcopy, slot, None), msg=msg)
855
856 def check_unpickling_error(self, errors, data):
857 with self.subTest(data=data), \

Callers 15

test_load_from_data0Method · 0.95
test_load_from_data1Method · 0.95
test_load_from_data2Method · 0.95
test_load_from_data3Method · 0.95
test_load_from_data4Method · 0.95
test_maxint64Method · 0.95
test_misc_getMethod · 0.95
test_miscMethod · 0.80
test_unicodeMethod · 0.80

Calls 8

hasattrFunction · 0.85
getattrFunction · 0.85
assertDictEqualMethod · 0.80
assertIsNotMethod · 0.80
assertListEqualMethod · 0.80
formatMethod · 0.45
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected