Skip to content

Commit 08b7e29

Browse files
committed
MAINT: make sure classmethods get wrapped
1 parent a739cfe commit 08b7e29

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/array_api_extra/testing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ def test_myfunc(xp):
237237
# to ensure that this is preserved.
238238
raw_attr = getattr_static(cls, method_name)
239239
method = getattr(cls, method_name)
240+
if isinstance(raw_attr, classmethod):
241+
method = method.__func__
240242
cloned_method = _clone_function(method)
241243

242244
method_to_set: Any
@@ -249,6 +251,8 @@ def test_myfunc(xp):
249251

250252
setattr(cls, method_name, method_to_set)
251253
f = getattr(cls, method_name)
254+
if isinstance(raw_attr, classmethod):
255+
f = f.__func__
252256
# Annotate that cls owns this method so we can check that later.
253257
tags["owner"] = cls
254258
else:

0 commit comments

Comments
 (0)