diff --git a/odl/test/discr/discr_space_test.py b/odl/test/discr/discr_space_test.py index 8c8a89820ba..69c6ac7fee7 100644 --- a/odl/test/discr/discr_space_test.py +++ b/odl/test/discr/discr_space_test.py @@ -907,7 +907,9 @@ def test_ufunc_corner_cases(odl_tspace_impl): # --- UFuncs with nin = 1, nout = 1 --- # - with pytest.raises(ValueError): + wrong_argcount_error = ValueError if np.__version__<"1.21" else TypeError + + with pytest.raises(wrong_argcount_error): # Too many arguments x.__array_ufunc__(np.sin, '__call__', x, np.ones((2, 3))) @@ -938,7 +940,7 @@ def test_ufunc_corner_cases(odl_tspace_impl): # --- UFuncs with nin = 2, nout = 1 --- # - with pytest.raises(ValueError): + with pytest.raises(wrong_argcount_error): # Too few arguments x.__array_ufunc__(np.add, '__call__', x) diff --git a/odl/test/space/tensors_test.py b/odl/test/space/tensors_test.py index 2e1d751ff97..21cbf5e14bc 100644 --- a/odl/test/space/tensors_test.py +++ b/odl/test/space/tensors_test.py @@ -1542,7 +1542,9 @@ def test_ufunc_corner_cases(odl_tspace_impl): # --- Ufuncs with nin = 1, nout = 1 --- # - with pytest.raises(ValueError): + wrong_argcount_error = ValueError if np.__version__<"1.21" else TypeError + + with pytest.raises(wrong_argcount_error): # Too many arguments x.__array_ufunc__(np.sin, '__call__', x, np.ones((2, 3))) @@ -1573,7 +1575,7 @@ def test_ufunc_corner_cases(odl_tspace_impl): # --- Ufuncs with nin = 2, nout = 1 --- # - with pytest.raises(ValueError): + with pytest.raises(wrong_argcount_error): # Too few arguments x.__array_ufunc__(np.add, '__call__', x)