From d7dfb635457a14bd2a3eaccf2ed94423cedb33df Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Thu, 3 Sep 2020 06:20:39 -0600 Subject: BUG: Avoid using ``np.random`` in typing tests. Using `np.random` can cause mysterious test failures in mypy `api.run` with a report that 'error: Module has no attribute "rand"'. The fix here is to use `np.empty` instead of `np.random.rand`. Why this works is unknown at present. --- numpy/tests/typing/pass/flatiter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy') diff --git a/numpy/tests/typing/pass/flatiter.py b/numpy/tests/typing/pass/flatiter.py index 93c15f601..c0219eb2b 100644 --- a/numpy/tests/typing/pass/flatiter.py +++ b/numpy/tests/typing/pass/flatiter.py @@ -1,6 +1,6 @@ import numpy as np -a = np.random.rand(5).flat +a = np.empty((2, 2)).flat a.base a.copy() -- cgit v1.2.1