diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-02-16 10:35:08 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2018-02-16 10:35:08 -0700 |
commit | ef387dcb3c369c513ca0e77821b029cc2c267cfa (patch) | |
tree | e3cfb46f829c766dc43b3fd76eb6d6a468ac3f27 /numpy/polynomial | |
parent | 5c5a215fa1101479ae9b8d127be32679c9f3f105 (diff) | |
download | numpy-ef387dcb3c369c513ca0e77821b029cc2c267cfa.tar.gz |
MAINT: Do not use random when testing roots.
The `check_roots` function in numpy/polynomial/tests/test_classes.py was
using random numbers without a seed to generate the random roots to be
checked. This made the test sensitive to the random state, with the
result that currently two of the roots are close together and fail the
test to the default seven digit precision when running on the Mac. The
failure is probably due to a combination of library and compiler
differences between the Mac and the other platforms tested.. The fix
here is to hardwire the test values rather than use random numbers.
Diffstat (limited to 'numpy/polynomial')
-rw-r--r-- | numpy/polynomial/tests/test_classes.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/polynomial/tests/test_classes.py b/numpy/polynomial/tests/test_classes.py index 2ec8277ff..896137c9a 100644 --- a/numpy/polynomial/tests/test_classes.py +++ b/numpy/polynomial/tests/test_classes.py @@ -415,9 +415,9 @@ def check_divmod(Poly): def check_roots(Poly): - d = Poly.domain + random((2,))*.25 - w = Poly.window + random((2,))*.25 - tgt = np.sort(random((5,))) + d = Poly.domain * 1.25 + .25 + w = Poly.window + tgt = np.linspace(d[0], d[1], 5) res = np.sort(Poly.fromroots(tgt, domain=d, window=w).roots()) assert_almost_equal(res, tgt) # default domain and window |