From 917700c8576231004fe541d5956da8ca9188ca7e Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Sun, 6 Aug 2017 08:53:09 -0500 Subject: BUG: Don't allow an array to be passed as the dtype argument --- numpy/lib/tests/test_type_check.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'numpy/lib/tests') 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() -- cgit v1.2.1