()
| 89 | |
| 90 | |
| 91 | def test_extract_class_dict(): |
| 92 | class A(int): |
| 93 | """A docstring""" |
| 94 | |
| 95 | def method(self): |
| 96 | return "a" |
| 97 | |
| 98 | class B: |
| 99 | """B docstring""" |
| 100 | |
| 101 | B_CONSTANT = 42 |
| 102 | |
| 103 | def method(self): |
| 104 | return "b" |
| 105 | |
| 106 | class C(A, B): |
| 107 | C_CONSTANT = 43 |
| 108 | |
| 109 | def method_c(self): |
| 110 | return "c" |
| 111 | |
| 112 | clsdict = _extract_class_dict(C) |
| 113 | expected_keys = ["C_CONSTANT", "__doc__", "method_c"] |
| 114 | # New attribute in Python 3.13 beta 1 |
| 115 | # https://github.com/python/cpython/pull/118475 |
| 116 | if sys.version_info >= (3, 13): |
| 117 | expected_keys.insert(2, "__firstlineno__") |
| 118 | assert list(clsdict.keys()) == expected_keys |
| 119 | assert clsdict["C_CONSTANT"] == 43 |
| 120 | assert clsdict["__doc__"] is None |
| 121 | assert clsdict["method_c"](C()) == C().method_c() |
| 122 | |
| 123 | |
| 124 | class CloudPickleTest(unittest.TestCase): |
nothing calls this directly
no test coverage detected
searching dependent graphs…