summaryrefslogtreecommitdiff
path: root/numpy/tests/typing/fail/ndarray.py
diff options
context:
space:
mode:
authorJosh Wilson <person142@users.noreply.github.com>2020-06-07 12:25:19 -0700
committerJosh Wilson <person142@users.noreply.github.com>2020-06-07 12:25:19 -0700
commit3fee17a0da9277ee21e20018beeb2a42ef12a02f (patch)
tree58ca04f7d6a7ab603d9d7327d488f0bf5986cf4a /numpy/tests/typing/fail/ndarray.py
parent11b95d15f10c2bc652ed19d5e27efa0384396cb8 (diff)
downloadnumpy-3fee17a0da9277ee21e20018beeb2a42ef12a02f.tar.gz
MAINT: move typing tests cases into a subdirectory of numpy/tests
Diffstat (limited to 'numpy/tests/typing/fail/ndarray.py')
-rw-r--r--numpy/tests/typing/fail/ndarray.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/tests/typing/fail/ndarray.py b/numpy/tests/typing/fail/ndarray.py
new file mode 100644
index 000000000..5a5130d40
--- /dev/null
+++ b/numpy/tests/typing/fail/ndarray.py
@@ -0,0 +1,11 @@
+import numpy as np
+
+# Ban setting dtype since mutating the type of the array in place
+# makes having ndarray be generic over dtype impossible. Generally
+# users should use `ndarray.view` in this situation anyway. See
+#
+# https://github.com/numpy/numpy-stubs/issues/7
+#
+# for more context.
+float_array = np.array([1.0])
+float_array.dtype = np.bool_ # E: Property "dtype" defined in "ndarray" is read-only