summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-08-06 08:53:09 -0500
committerEric Wieser <wieser.eric@gmail.com>2017-08-06 12:02:04 -0500
commit917700c8576231004fe541d5956da8ca9188ca7e (patch)
treec6c1a4c128e68752ef7fa3b0f20b58c98697b678 /numpy/lib/tests
parent2489aded2dc7f779a66b5f93ea59ba4731c46b86 (diff)
downloadnumpy-917700c8576231004fe541d5956da8ca9188ca7e.tar.gz
BUG: Don't allow an array to be passed as the dtype argument
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_type_check.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py
index d863e5924..1b1af86da 100644
--- a/numpy/lib/tests/test_type_check.py
+++ b/numpy/lib/tests/test_type_check.py
@@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.compat import long
from numpy.testing import (
- assert_, assert_equal, assert_array_equal, run_module_suite
+ assert_, assert_equal, assert_array_equal, run_module_suite, assert_raises
)
from numpy.lib.type_check import (
common_type, mintypecode, isreal, iscomplex, isposinf, isneginf,
@@ -422,5 +422,11 @@ class TestArrayConversion(object):
assert_equal(a.__class__, np.ndarray)
assert_(np.issubdtype(a.dtype, float))
+ # previously this would infer dtypes from arrays, unlike every single
+ # other numpy function
+ assert_raises(TypeError,
+ asfarray, np.array([1, 2, 3]), dtype=np.array(1.0))
+
+
if __name__ == "__main__":
run_module_suite()