MCPcopy Create free account
hub / github.com/cloudpipe/cloudpickle / test_builtin_slotmethod

Method test_builtin_slotmethod

tests/cloudpickle_test.py:970–989  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

968 ) == clsdict_clsmethod.__func__(float, arg)
969
970 def test_builtin_slotmethod(self):
971 obj = 1.5 # float object
972
973 bound_slotmethod = obj.__repr__ # method-wrapper
974 unbound_slotmethod = type(obj).__repr__ # wrapper_descriptor
975 clsdict_slotmethod = type(obj).__dict__["__repr__"] # ditto
976
977 depickled_bound_meth = pickle_depickle(bound_slotmethod, protocol=self.protocol)
978 depickled_unbound_meth = pickle_depickle(
979 unbound_slotmethod, protocol=self.protocol
980 )
981 depickled_clsdict_meth = pickle_depickle(
982 clsdict_slotmethod, protocol=self.protocol
983 )
984
985 # No identity tests on the bound slotmethod are they are bound to
986 # different float instances
987 assert depickled_bound_meth() == bound_slotmethod()
988 assert depickled_unbound_meth is unbound_slotmethod
989 assert depickled_clsdict_meth is clsdict_slotmethod
990
991 @pytest.mark.skipif(
992 platform.python_implementation() == "PyPy",

Callers

nothing calls this directly

Calls 1

pickle_depickleFunction · 0.85

Tested by

no test coverage detected