@@ -31,7 +31,8 @@ def squeeze(x, /, axis):
31
31
32
32
from . import dtype_helpers as dh
33
33
from . import xp
34
- from .stubs import array_methods , category_to_funcs , extension_to_funcs , name_to_func
34
+ from .stubs import (array_methods , category_to_funcs , extension_to_funcs ,
35
+ name_to_func , info_funcs )
35
36
36
37
ParameterKind = Literal [
37
38
Parameter .POSITIONAL_ONLY ,
@@ -307,3 +308,15 @@ def test_array_method_signature(stub: FunctionType):
307
308
assert hasattr (x , stub .__name__ ), f"{ stub .__name__ } not found in array object { x !r} "
308
309
method = getattr (x , stub .__name__ )
309
310
_test_func_signature (method , stub , is_method = True )
311
+
312
+ if info_funcs : # pytest fails collecting if info_funcs is empty
313
+ @pytest .mark .min_version ("2023.12" )
314
+ @pytest .mark .parametrize ("stub" , info_funcs , ids = lambda f : f .__name__ )
315
+ def test_info_func_signature (stub : FunctionType ):
316
+ try :
317
+ info_namespace = xp .__array_namespace_info__ ()
318
+ except Exception as e :
319
+ raise AssertionError (f"Could not get info namespace from xp.__array_namespace_info__(): { e } " )
320
+
321
+ func = getattr (info_namespace , stub .__name__ )
322
+ _test_func_signature (func , stub )
0 commit comments