[pypy-commit] pypy default: add tests that expose crashes

mattip noreply at buildbot.pypy.org
Thu Apr 4 22:03:51 CEST 2013


Author: Matti Picus <matti.picus at gmail.com>
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')
 


More information about the pypy-commit mailing list