From ef387dcb3c369c513ca0e77821b029cc2c267cfa Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Fri, 16 Feb 2018 10:35:08 -0700 Subject: 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. --- numpy/polynomial/tests/test_classes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'numpy/polynomial/tests/test_classes.py') 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 -- cgit v1.2.1