Skip to content

Commit 4044a65

Browse files
merge/resolve
1 parent b0d0075 commit 4044a65

File tree

1 file changed

+39
-18
lines changed

1 file changed

+39
-18
lines changed

numba_cuda/numba/cuda/tests/cudapy/test_extending.py

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ def test_func1(self):
404404
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
405405
cfunc = jit(pyfunc)
406406
self.assertPreciseEqual(res[0], 42.0)
407-
cfunc[1, 1](18.0, res)
407+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
408+
cfunc[1, 1](18.0, res)
408409
self.assertPreciseEqual(res[0], 6.0)
409410

410411
@TestCase.run_test_in_subprocess
@@ -451,7 +452,8 @@ def impl1(a, b, c, kw=12):
451452
return -1
452453

453454
with self.assertRaises(errors.TypingError) as e:
454-
gen_ol(impl1)[1, 1](1, 2, 3, 4)
455+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
456+
gen_ol(impl1)[1, 1](1, 2, 3, 4)
455457
msg = str(e.exception)
456458
self.assertIn(sentinel, msg)
457459
self.assertIn("keyword argument default values", msg)
@@ -466,7 +468,8 @@ def impl2(a, b, c, kwarg=None):
466468
return -1
467469

468470
with self.assertRaises(errors.TypingError) as e:
469-
gen_ol(impl2)[1, 1](1, 2, 3, 4)
471+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
472+
gen_ol(impl2)[1, 1](1, 2, 3, 4)
470473
msg = str(e.exception)
471474
self.assertIn(sentinel, msg)
472475
self.assertIn("keyword argument names", msg)
@@ -481,7 +484,8 @@ def impl3(z, b, c, kw=None):
481484
return -1
482485

483486
with self.assertRaises(errors.TypingError) as e:
484-
gen_ol(impl3)[1, 1](1, 2, 3, 4)
487+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
488+
gen_ol(impl3)[1, 1](1, 2, 3, 4)
485489
msg = str(e.exception)
486490
self.assertIn(sentinel, msg)
487491
self.assertIn("argument names", msg)
@@ -492,15 +496,17 @@ def impl3(z, b, c, kw=None):
492496
from .overload_usecases import impl4, impl5
493497

494498
with self.assertRaises(errors.TypingError) as e:
495-
gen_ol(impl4)[1, 1](1, 2, 3, 4)
499+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
500+
gen_ol(impl4)[1, 1](1, 2, 3, 4)
496501
msg = str(e.exception)
497502
self.assertIn(sentinel, msg)
498503
self.assertIn("argument names", msg)
499504
self.assertFalse("keyword" in msg)
500505
self.assertIn("First difference: 'z'", msg)
501506

502507
with self.assertRaises(errors.TypingError) as e:
503-
gen_ol(impl5)[1, 1](1, 2, 3, 4)
508+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
509+
gen_ol(impl5)[1, 1](1, 2, 3, 4)
504510
msg = str(e.exception)
505511
self.assertIn(sentinel, msg)
506512
self.assertIn("argument names", msg)
@@ -516,7 +522,8 @@ def impl6(a, b, c, d, e, kw=None):
516522
return -1
517523

518524
with self.assertRaises(errors.TypingError) as e:
519-
gen_ol(impl6)[1, 1](1, 2, 3, 4)
525+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
526+
gen_ol(impl6)[1, 1](1, 2, 3, 4)
520527
msg = str(e.exception)
521528
self.assertIn(sentinel, msg)
522529
self.assertIn("argument names", msg)
@@ -532,7 +539,8 @@ def impl7(a, b, kw=None):
532539
return -1
533540

534541
with self.assertRaises(errors.TypingError) as e:
535-
gen_ol(impl7)[1, 1](1, 2, 3, 4)
542+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
543+
gen_ol(impl7)[1, 1](1, 2, 3, 4)
536544
msg = str(e.exception)
537545
self.assertIn(sentinel, msg)
538546
self.assertIn("argument names", msg)
@@ -547,7 +555,8 @@ def impl8(a, b, c, kw=None, extra_kwarg=None):
547555
return -1
548556

549557
with self.assertRaises(errors.TypingError) as e:
550-
gen_ol(impl8)[1, 1](1, 2, 3, 4)
558+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
559+
gen_ol(impl8)[1, 1](1, 2, 3, 4)
551560
msg = str(e.exception)
552561
self.assertIn(sentinel, msg)
553562
self.assertIn("keyword argument names", msg)
@@ -561,7 +570,8 @@ def impl9(a, b, c):
561570
return -1
562571

563572
with self.assertRaises(errors.TypingError) as e:
564-
gen_ol(impl9)[1, 1](1, 2, 3, 4)
573+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
574+
gen_ol(impl9)[1, 1](1, 2, 3, 4)
565575
msg = str(e.exception)
566576
self.assertIn(sentinel, msg)
567577
self.assertIn("keyword argument names", msg)
@@ -585,7 +595,8 @@ def foo(a, b):
585595
myoverload(a, b, 9, kw=11)
586596

587597
with self.assertRaises(errors.TypingError) as e:
588-
foo[1, 1](1, 5)
598+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
599+
foo[1, 1](1, 5)
589600
msg = str(e.exception)
590601
self.assertIn("VAR_POSITIONAL (e.g. *args) argument kind", msg)
591602
self.assertIn("offending argument name is '*star_args_token'", msg)
@@ -614,9 +625,13 @@ def impl(a, kw=10):
614625

615626
return impl
616627

617-
gen_ol(ol1, False)[1, 1](1, 2) # no error if strictness not enforced
628+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
629+
gen_ol(ol1, False)[1, 1](
630+
1, 2
631+
) # no error if strictness not enforced
618632
with self.assertRaises(errors.TypingError) as e:
619-
gen_ol(ol1)[1, 1](1, 2)
633+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
634+
gen_ol(ol1)[1, 1](1, 2)
620635
msg = str(e.exception)
621636
self.assertIn("use of VAR_KEYWORD (e.g. **kwargs) is unsupported", msg)
622637
self.assertIn("offending argument name is '**kws'", msg)
@@ -629,7 +644,8 @@ def impl(a, **kws):
629644
return impl
630645

631646
with self.assertRaises(errors.TypingError) as e:
632-
gen_ol(ol2)[1, 1](1, 2)
647+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
648+
gen_ol(ol2)[1, 1](1, 2)
633649
msg = str(e.exception)
634650
self.assertIn("use of VAR_KEYWORD (e.g. **kwargs) is unsupported", msg)
635651
self.assertIn("offending argument name is '**kws'", msg)
@@ -726,10 +742,12 @@ def call_non_void_func():
726742
non_void_func(1)
727743

728744
# void func should work
729-
self.assertEqual(call_void_func[1, 1](), None)
745+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
746+
self.assertEqual(call_void_func[1, 1](), None)
730747
# not void function should raise exception
731748
with self.assertRaises(LoweringError) as e:
732-
call_non_void_func[1, 1]()
749+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
750+
call_non_void_func[1, 1]()
733751
self.assertIn("non-void function returns None", e.exception.msg)
734752

735753
def test_serialization(self):
@@ -751,7 +769,8 @@ def codegen(context, builder, signature, args):
751769
def foo(x):
752770
identity(x)
753771

754-
self.assertEqual(foo[1, 1](1), None)
772+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
773+
self.assertEqual(foo[1, 1](1), None)
755774

756775
# get serialization memo
757776
memo = _Intrinsic._memo
@@ -766,7 +785,9 @@ def foo(x):
766785
foo_rebuilt = pickle.loads(serialized_foo)
767786
self.assertEqual(memo_size, len(memo))
768787
# check rebuilt foo
769-
self.assertEqual(foo[1, 1](1), foo_rebuilt[1, 1](1))
788+
789+
with override_config("DISABLE_PERFORMANCE_WARNINGS", 1):
790+
self.assertEqual(foo[1, 1](1), foo_rebuilt[1, 1](1))
770791

771792
# pickle identity directly
772793
serialized_identity = pickle.dumps(identity)

0 commit comments

Comments
 (0)