Author: Matti Picus <[email protected]>
Branch: 
Changeset: r63015:8ac3a0de8854
Date: 2013-04-04 19:21 +0300
http://bitbucket.org/pypy/pypy/changeset/8ac3a0de8854/

Log:    add tests that expose crashes

diff --git a/pypy/module/micronumpy/test/test_numarray.py 
b/pypy/module/micronumpy/test/test_numarray.py
--- a/pypy/module/micronumpy/test/test_numarray.py
+++ b/pypy/module/micronumpy/test/test_numarray.py
@@ -1487,14 +1487,14 @@
         a = concatenate((['abcdef'], ['abc']))
         assert a[0] == 'abcdef'
         assert str(a.dtype) == '|S6'
-    
+
     def test_record_concatenate(self):
         # only an exact match can succeed
         from numpypy import zeros, concatenate
         a = concatenate((zeros((2,),dtype=[('x', int), ('y', float)]),
                          zeros((2,),dtype=[('x', int), ('y', float)])))
         assert a.shape == (4,)
-        exc = raises(TypeError, concatenate, 
+        exc = raises(TypeError, concatenate,
                             (zeros((2,), dtype=[('x', int), ('y', float)]),
                             (zeros((2,), dtype=[('x', float), ('y', float)]))))
         assert str(exc.value).startswith('record type mismatch')
@@ -1678,8 +1678,12 @@
         assert a.itemsize == 3
         # scalar vs. array
         try:
+            a = array(['1', '2','3']).astype(float)
+            assert a[2] == 3.0
             a = array([1, 2, 3.14156]).astype('S3').dtype
             assert a.itemsize == 3
+            a = array(3.1415).astype('S3').dtype
+            assert a.itemsize == 3
         except NotImplementedError:
             skip('astype("S3") not implemented for numeric arrays')
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to