TST: Bump the python 3.10 test version from beta4 to rc1 by BvB93 · Pull Request #19612 · numpy/numpy · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_test.yml
4 changes: 2 additions & 2 deletions numpy/core/numerictypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class _typedict(Dict[Type[generic], _T]):
if sys.version_info >= (3, 10):
_TypeTuple = Union[
Type[Any],
types.Union,
Tuple[Union[Type[Any], types.Union, Tuple[Any, ...]], ...],
types.UnionType,
Tuple[Union[Type[Any], types.UnionType, Tuple[Any, ...]], ...],
]
else:
_TypeTuple = Union[
Expand Down
40 changes: 27 additions & 13 deletions numpy/core/tests/test_umath_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,18 @@ def test_scalar(self):
x = np.array([1, 1j, 2, 2.5+.37j, np.inf, np.nan])
y = np.array([1, 1j, -0.5+1.5j, -0.5+1.5j, 2, 3])
lx = list(range(len(x)))
# Compute the values for complex type in python
p_r = [complex(x[i]) ** complex(y[i]) for i in lx]
# Substitute a result allowed by C99 standard
p_r[4] = complex(np.inf, np.nan)
# Do the same with numpy complex scalars

# Hardcode the expected `builtins.complex` values,
# as complex exponentiation is broken as of bpo-44698
p_r = [
1+0j,
0.20787957635076193+0j,
0.35812203996480685+0.6097119028618724j,
0.12659112128185032+0.48847676699581527j,
complex(np.inf, np.nan),
complex(np.nan, np.nan),
]

n_r = [x[i] ** y[i] for i in lx]
for i in lx:
assert_almost_equal(n_r[i], p_r[i], err_msg='Loop %d\n' % i)
Expand All @@ -385,11 +392,18 @@ def test_array(self):
x = np.array([1, 1j, 2, 2.5+.37j, np.inf, np.nan])
y = np.array([1, 1j, -0.5+1.5j, -0.5+1.5j, 2, 3])
lx = list(range(len(x)))
# Compute the values for complex type in python
p_r = [complex(x[i]) ** complex(y[i]) for i in lx]
# Substitute a result allowed by C99 standard
p_r[4] = complex(np.inf, np.nan)
# Do the same with numpy arrays

# Hardcode the expected `builtins.complex` values,
# as complex exponentiation is broken as of bpo-44698
p_r = [
1+0j,
0.20787957635076193+0j,
0.35812203996480685+0.6097119028618724j,
0.12659112128185032+0.48847676699581527j,
complex(np.inf, np.nan),
complex(np.nan, np.nan),
]

n_r = x ** y
for i in lx:
assert_almost_equal(n_r[i], p_r[i], err_msg='Loop %d\n' % i)
Expand Down Expand Up @@ -583,7 +597,7 @@ class TestComplexAbsoluteMixedDTypes:
@pytest.mark.parametrize("stride", [-4,-3,-2,-1,1,2,3,4])
@pytest.mark.parametrize("astype", [np.complex64, np.complex128])
@pytest.mark.parametrize("func", ['abs', 'square', 'conjugate'])

def test_array(self, stride, astype, func):
dtype = [('template_id', '<i8'), ('bank_chisq','<f4'),
('bank_chisq_dof','<i8'), ('chisq', '<f4'), ('chisq_dof','<i8'),
Expand All @@ -602,9 +616,9 @@ def test_array(self, stride, astype, func):
myfunc = getattr(np, func)
a = vec['mycomplex']
g = myfunc(a[::stride])

b = vec['mycomplex'].copy()
h = myfunc(b[::stride])

assert_array_max_ulp(h.real, g.real, 1)
assert_array_max_ulp(h.imag, g.imag, 1)
6 changes: 5 additions & 1 deletion numpy/lib/tests/test_utils.py