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

Method test_builtin_classicmethod

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

Source from the content-addressed store, hash-verified

876 # identified is with it's builtin-code __code__ attribute.
877
878 def test_builtin_classicmethod(self):
879 obj = 1.5 # float object
880
881 bound_classicmethod = obj.hex # builtin_function_or_method
882 unbound_classicmethod = type(obj).hex # method_descriptor
883 clsdict_classicmethod = type(obj).__dict__["hex"] # method_descriptor
884
885 assert unbound_classicmethod is clsdict_classicmethod
886
887 depickled_bound_meth = pickle_depickle(
888 bound_classicmethod, protocol=self.protocol
889 )
890 depickled_unbound_meth = pickle_depickle(
891 unbound_classicmethod, protocol=self.protocol
892 )
893 depickled_clsdict_meth = pickle_depickle(
894 clsdict_classicmethod, protocol=self.protocol
895 )
896
897 # No identity on the bound methods they are bound to different float
898 # instances
899 assert depickled_bound_meth() == bound_classicmethod()
900 assert depickled_unbound_meth is unbound_classicmethod
901 assert depickled_clsdict_meth is clsdict_classicmethod
902
903 def test_builtin_classmethod(self):
904 obj = 1.5 # float object

Callers

nothing calls this directly

Calls 1

pickle_depickleFunction · 0.85

Tested by

no test coverage detected