summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-09-03 06:20:39 -0600
committerCharles Harris <charlesr.harris@gmail.com>2020-09-03 06:20:39 -0600
commitd7dfb635457a14bd2a3eaccf2ed94423cedb33df (patch)
tree109e0eb247a942198ad9ee74b1536a4508d5533e /numpy
parent1f8ce6341159ebb0731c2c262f4576609210d2c8 (diff)
downloadnumpy-d7dfb635457a14bd2a3eaccf2ed94423cedb33df.tar.gz
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.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/tests/typing/pass/flatiter.py2
1 files changed, 1 insertions, 1 deletions
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()