@@ -117,6 +117,23 @@ def __call__(self, a: int, b: int) -> int:
117117_test_ufunc = _Test_ufunc ()
118118
119119
120+ class Test_helpers :
121+ def test_is_wrapped_true (self ) -> None :
122+ wrapped = m .implemented (_test_func , "foo" , "_test_func" )
123+ assert m .is_wrapped (wrapped )
124+
125+ def test_is_wrapped_false (self ) -> None :
126+ assert not m .is_wrapped (10 )
127+
128+ def test_is_implemented_true (self ) -> None :
129+ wrapped = m .implemented (_test_func , "foo" , "_test_func" )
130+ assert m .is_implemented (wrapped )
131+
132+ def test_is_implemented_false (self ) -> None :
133+ wrapped = m .unimplemented (_test_func , "foo" , "_test_func" )
134+ assert not m .is_implemented (wrapped )
135+
136+
120137class Test_implemented :
121138 @patch ("cupynumeric.runtime.record_api_call" )
122139 def test_reporting_True_func (
@@ -347,10 +364,10 @@ def test_report_coverage_True(self) -> None:
347364 assert _Dest .attr2 == 30
348365
349366 assert _Dest .function1 .__wrapped__ is _OriginMod .function1
350- assert not _Dest .function1 ._cupynumeric .implemented
367+ assert not _Dest .function1 ._cupynumeric_metadata .implemented
351368
352369 assert _Dest .function2 .__wrapped__
353- assert _Dest .function2 ._cupynumeric .implemented
370+ assert _Dest .function2 ._cupynumeric_metadata .implemented
354371
355372 assert not hasattr (_Dest .extra , "_cupynumeric" )
356373
@@ -373,10 +390,10 @@ def test_report_coverage_False(self) -> None:
373390 assert _Dest .attr2 == 30
374391
375392 assert _Dest .function1 .__wrapped__ is _OriginMod .function1
376- assert not _Dest .function1 ._cupynumeric .implemented
393+ assert not _Dest .function1 ._cupynumeric_metadata .implemented
377394
378395 assert _Dest .function2 .__wrapped__
379- assert _Dest .function2 ._cupynumeric .implemented
396+ assert _Dest .function2 ._cupynumeric_metadata .implemented
380397
381398 assert not hasattr (_Dest .extra , "_cupynumeric" )
382399
@@ -428,10 +445,10 @@ def test_report_coverage_True(self) -> None:
428445 assert _Test_ndarray .attr2 == 30
429446
430447 assert _Test_ndarray .foo .__wrapped__ is _Orig_ndarray .foo
431- assert not _Test_ndarray .foo ._cupynumeric .implemented
448+ assert not _Test_ndarray .foo ._cupynumeric_metadata .implemented
432449
433450 assert _Test_ndarray .bar .__wrapped__
434- assert _Test_ndarray .bar ._cupynumeric .implemented
451+ assert _Test_ndarray .bar ._cupynumeric_metadata .implemented
435452
436453 assert not hasattr (_Test_ndarray .extra , "_cupynumeric" )
437454
@@ -447,10 +464,10 @@ def test_report_coverage_False(self) -> None:
447464 assert _Test_ndarray .attr2 == 30
448465
449466 assert _Test_ndarray .foo .__wrapped__ is _Orig_ndarray .foo
450- assert not _Test_ndarray .foo ._cupynumeric .implemented
467+ assert not _Test_ndarray .foo ._cupynumeric_metadata .implemented
451468
452469 assert _Test_ndarray .bar .__wrapped__
453- assert _Test_ndarray .bar ._cupynumeric .implemented
470+ assert _Test_ndarray .bar ._cupynumeric_metadata .implemented
454471
455472 assert not hasattr (_Test_ndarray .extra , "_cupynumeric" )
456473
@@ -469,32 +486,32 @@ def test_ufunc_methods_binary() -> None:
469486
470487 # reduce is implemented
471488 assert np .add .reduce .__wrapped__
472- assert np .add .reduce ._cupynumeric .implemented
489+ assert np .add .reduce ._cupynumeric_metadata .implemented
473490
474491 # the rest are not
475492 assert np .add .reduceat .__wrapped__
476- assert not np .add .reduceat ._cupynumeric .implemented
493+ assert not np .add .reduceat ._cupynumeric_metadata .implemented
477494 assert np .add .outer .__wrapped__
478- assert not np .add .outer ._cupynumeric .implemented
495+ assert not np .add .outer ._cupynumeric_metadata .implemented
479496 assert np .add .at .__wrapped__
480- assert not np .add .at ._cupynumeric .implemented
497+ assert not np .add .at ._cupynumeric_metadata .implemented
481498 assert np .add .accumulate .__wrapped__
482- assert not np .add .accumulate ._cupynumeric .implemented
499+ assert not np .add .accumulate ._cupynumeric_metadata .implemented
483500
484501
485502def test_ufunc_methods_unary () -> None :
486503 import cupynumeric as np
487504
488505 assert np .negative .reduce .__wrapped__
489- assert not np .negative .reduce ._cupynumeric .implemented
506+ assert not np .negative .reduce ._cupynumeric_metadata .implemented
490507 assert np .negative .reduceat .__wrapped__
491- assert not np .negative .reduceat ._cupynumeric .implemented
508+ assert not np .negative .reduceat ._cupynumeric_metadata .implemented
492509 assert np .negative .outer .__wrapped__
493- assert not np .negative .outer ._cupynumeric .implemented
510+ assert not np .negative .outer ._cupynumeric_metadata .implemented
494511 assert np .negative .at .__wrapped__
495- assert not np .negative .at ._cupynumeric .implemented
512+ assert not np .negative .at ._cupynumeric_metadata .implemented
496513 assert np .negative .accumulate .__wrapped__
497- assert not np .negative .accumulate ._cupynumeric .implemented
514+ assert not np .negative .accumulate ._cupynumeric_metadata .implemented
498515
499516
500517if __name__ == "__main__" :
0 commit comments