[Numpy-svn] r3938 - in trunk/numpy/lib: . tests

numpy-svn at scipy.org numpy-svn at scipy.org
Wed Aug 1 19:48:59 EDT 2007


Author: stefan
Date: 2007-08-01 18:48:41 -0500 (Wed, 01 Aug 2007)
New Revision: 3938

Modified:
   trunk/numpy/lib/tests/test_type_check.py
   trunk/numpy/lib/type_check.py
Log:
Fix asfarray to return an array instead of a matrix.


Modified: trunk/numpy/lib/tests/test_type_check.py
===================================================================
--- trunk/numpy/lib/tests/test_type_check.py	2007-07-28 19:44:07 UTC (rev 3937)
+++ trunk/numpy/lib/tests/test_type_check.py	2007-08-01 23:48:41 UTC (rev 3938)
@@ -270,5 +270,11 @@
         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()

Modified: trunk/numpy/lib/type_check.py
===================================================================
--- trunk/numpy/lib/type_check.py	2007-07-28 19:44:07 UTC (rev 3937)
+++ trunk/numpy/lib/type_check.py	2007-08-01 23:48:41 UTC (rev 3938)
@@ -46,7 +46,7 @@
     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.




More information about the Numpy-svn mailing list