Skip to content

Commit 99eac42

Browse files
authored
Merge pull request #19612 from BvB93/test
TST: Bump the python 3.10 test version from beta4 to rc1
2 parents 3aad149 + 4743e36 commit 99eac42

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

.github/workflows/build_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
runs-on: ubuntu-latest
5757
strategy:
5858
matrix:
59-
python-version: [3.7, 3.9, 3.10.0-beta.4]
59+
python-version: [3.7, 3.9, 3.10.0-rc.1]
6060
steps:
6161
- uses: actions/checkout@v2
6262
with:

numpy/core/numerictypes.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class _typedict(Dict[Type[generic], _T]):
8686
if sys.version_info >= (3, 10):
8787
_TypeTuple = Union[
8888
Type[Any],
89-
types.Union,
90-
Tuple[Union[Type[Any], types.Union, Tuple[Any, ...]], ...],
89+
types.UnionType,
90+
Tuple[Union[Type[Any], types.UnionType, Tuple[Any, ...]], ...],
9191
]
9292
else:
9393
_TypeTuple = Union[

numpy/core/tests/test_umath_complex.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,18 @@ def test_scalar(self):
372372
x = np.array([1, 1j, 2, 2.5+.37j, np.inf, np.nan])
373373
y = np.array([1, 1j, -0.5+1.5j, -0.5+1.5j, 2, 3])
374374
lx = list(range(len(x)))
375-
# Compute the values for complex type in python
376-
p_r = [complex(x[i]) ** complex(y[i]) for i in lx]
377-
# Substitute a result allowed by C99 standard
378-
p_r[4] = complex(np.inf, np.nan)
379-
# Do the same with numpy complex scalars
375+
376+
# Hardcode the expected `builtins.complex` values,
377+
# as complex exponentiation is broken as of bpo-44698
378+
p_r = [
379+
1+0j,
380+
0.20787957635076193+0j,
381+
0.35812203996480685+0.6097119028618724j,
382+
0.12659112128185032+0.48847676699581527j,
383+
complex(np.inf, np.nan),
384+
complex(np.nan, np.nan),
385+
]
386+
380387
n_r = [x[i] ** y[i] for i in lx]
381388
for i in lx:
382389
assert_almost_equal(n_r[i], p_r[i], err_msg='Loop %d\n' % i)
@@ -385,11 +392,18 @@ def test_array(self):
385392
x = np.array([1, 1j, 2, 2.5+.37j, np.inf, np.nan])
386393
y = np.array([1, 1j, -0.5+1.5j, -0.5+1.5j, 2, 3])
387394
lx = list(range(len(x)))
388-
# Compute the values for complex type in python
389-
p_r = [complex(x[i]) ** complex(y[i]) for i in lx]
390-
# Substitute a result allowed by C99 standard
391-
p_r[4] = complex(np.inf, np.nan)
392-
# Do the same with numpy arrays
395+
396+
# Hardcode the expected `builtins.complex` values,
397+
# as complex exponentiation is broken as of bpo-44698
398+
p_r = [
399+
1+0j,
400+
0.20787957635076193+0j,
401+
0.35812203996480685+0.6097119028618724j,
402+
0.12659112128185032+0.48847676699581527j,
403+
complex(np.inf, np.nan),
404+
complex(np.nan, np.nan),
405+
]
406+
393407
n_r = x ** y
394408
for i in lx:
395409
assert_almost_equal(n_r[i], p_r[i], err_msg='Loop %d\n' % i)
@@ -583,7 +597,7 @@ class TestComplexAbsoluteMixedDTypes:
583597
@pytest.mark.parametrize("stride", [-4,-3,-2,-1,1,2,3,4])
584598
@pytest.mark.parametrize("astype", [np.complex64, np.complex128])
585599
@pytest.mark.parametrize("func", ['abs', 'square', 'conjugate'])
586-
600+
587601
def test_array(self, stride, astype, func):
588602
dtype = [('template_id', '<i8'), ('bank_chisq','<f4'),
589603
('bank_chisq_dof','<i8'), ('chisq', '<f4'), ('chisq_dof','<i8'),
@@ -602,9 +616,9 @@ def test_array(self, stride, astype, func):
602616
myfunc = getattr(np, func)
603617
a = vec['mycomplex']
604618
g = myfunc(a[::stride])
605-
619+
606620
b = vec['mycomplex'].copy()
607621
h = myfunc(b[::stride])
608-
622+
609623
assert_array_max_ulp(h.real, g.real, 1)
610624
assert_array_max_ulp(h.imag, g.imag, 1)

numpy/lib/tests/test_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212

1313
@pytest.mark.skipif(sys.flags.optimize == 2, reason="Python running -OO")
14+
@pytest.mark.skipif(
15+
sys.version_info == (3, 10, 0, "candidate", 1),
16+
reason="Broken as of bpo-44524",
17+
)
1418
def test_lookfor():
1519
out = StringIO()
1620
utils.lookfor('eigenvalue', module='numpy', output=out,
@@ -160,7 +164,7 @@ class NoPublicMethods:
160164
class WithPublicMethods:
161165
def first_method():
162166
pass
163-
167+
164168
def _has_method_heading(cls):
165169
out = StringIO()
166170
utils.info(cls, output=out)

0 commit comments

Comments
 (0)