Skip factorial() float tests on Python 3.10

- resolves: #1898157
This commit is contained in:
Nikola Forró 2020-11-25 19:08:00 +01:00
parent d411bdc4f2
commit 138e3931a6
2 changed files with 47 additions and 1 deletions

View File

@ -15,7 +15,7 @@
Summary: Scientific Tools for Python
Name: scipy
Version: 1.5.4
Release: 1%{?dist}
Release: 2%{?dist}
# BSD -- whole package except:
# Boost -- scipy/special/cephes/scipy_iv.c
@ -26,6 +26,8 @@ Source0: https://github.com/scipy/scipy/releases/download/v%{version}/scipy-%
# https://github.com/scipy/scipy/pull/12899
Patch0: skip-certain-tests-on-32-bit-arches.patch
# https://github.com/scipy/scipy/pull/13130
Patch1: skip-factorial-float-tests-on-py310.patch
BuildRequires: fftw-devel, suitesparse-devel
BuildRequires: %{blaslib}-devel
@ -171,6 +173,10 @@ popd
%endif
%changelog
* Wed Nov 25 2020 Nikola Forró <nforro@redhat.com> - 1.5.4-2
- Skip factorial() float tests on Python 3.10
resolves: #1898157
* Thu Nov 05 2020 Nikola Forró <nforro@redhat.com> - 1.5.4-1
- New upstream release 1.5.4
- Increase test timeout, 300 seconds is not always enough

View File

@ -0,0 +1,40 @@
From eabd8ea25fe291665f37fd069a1c574cd30d12cc Mon Sep 17 00:00:00 2001
From: Victor Stinner <vstinner@python.org>
Date: Wed, 25 Nov 2020 11:41:15 +0100
Subject: [PATCH] GH-13122: Skip factorial() float tests on Python 3.10
special.factorial() argument should be an array of integers.
On Python 3.10, math.factorial() reject float.
On Python 3.9, a DeprecationWarning is emitted.
A numpy array casts all integers to float if the array contains a
single NaN.
---
scipy/special/tests/test_basic.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/scipy/special/tests/test_basic.py b/scipy/special/tests/test_basic.py
index 9b7260e8435..e2ae29812a5 100644
--- a/scipy/special/tests/test_basic.py
+++ b/scipy/special/tests/test_basic.py
@@ -19,6 +19,7 @@
import itertools
import platform
+import sys
import numpy as np
from numpy import (array, isnan, r_, arange, finfo, pi, sin, cos, tan, exp,
@@ -1822,6 +1823,13 @@ def test_nan_inputs(self, x, exact):
result = special.factorial(x, exact=exact)
assert_(np.isnan(result))
+ # GH-13122: special.factorial() argument should be an array of integers.
+ # On Python 3.10, math.factorial() reject float.
+ # On Python 3.9, a DeprecationWarning is emitted.
+ # A numpy array casts all integers to float if the array contains a
+ # single NaN.
+ @pytest.mark.skipif(sys.version_info >= (3, 10),
+ reason="Python 3.10+ math.factorial() requires int")
def test_mixed_nan_inputs(self):
x = np.array([np.nan, 1, 2, 3, np.nan])
with suppress_warnings() as sup: