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

Method test_classmethod

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

Source from the content-addressed store, hash-verified

493 assert list(gen2(3)) == list(range(3))
494
495 def test_classmethod(self):
496 class A:
497 @staticmethod
498 def test_sm():
499 return "sm"
500
501 @classmethod
502 def test_cm(cls):
503 return "cm"
504
505 sm = A.__dict__["test_sm"]
506 cm = A.__dict__["test_cm"]
507
508 A.test_sm = pickle_depickle(sm, protocol=self.protocol)
509 A.test_cm = pickle_depickle(cm, protocol=self.protocol)
510
511 self.assertEqual(A.test_sm(), "sm")
512 self.assertEqual(A.test_cm(), "cm")
513
514 def test_bound_classmethod(self):
515 class A:

Callers

nothing calls this directly

Calls 3

pickle_depickleFunction · 0.85
test_smMethod · 0.80
test_cmMethod · 0.80

Tested by

no test coverage detected