diff options
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/tests/test_type_check.py | 6 | ||||
-rw-r--r-- | numpy/lib/type_check.py | 2 |
2 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 8b990c57e..a89d6ce7f 100644 --- a/numpy/lib/tests/test_type_check.py +++ b/numpy/lib/tests/test_type_check.py @@ -270,5 +270,11 @@ class test_real_if_close(NumpyTestCase): b = real_if_close(a+1e-7j,tol=1e-6) assert_all(isrealobj(b)) +class test_array_conversion(NumpyTestCase): + def check_asfarray(self): + a = asfarray(array([1,2,3])) + assert_equal(a.__class__,ndarray) + assert issubdtype(a.dtype,float) + if __name__ == "__main__": NumpyTest().run() diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 8e10ac2b5..60c84e335 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -46,7 +46,7 @@ def asfarray(a, dtype=_nx.float_): dtype = _nx.obj2sctype(dtype) if not issubclass(dtype, _nx.inexact): dtype = _nx.float_ - return asanyarray(a,dtype=dtype) + return asarray(a,dtype=dtype) def real(val): """Return the real part of val. |