mattip committed 862f40e

cleanup, make the prod test pass for numpypy and numpy ( -A )

  • Participants
  • Parent commits 84c4bc0

Comments (0)

Files changed (2)


-import sys
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, operationerrfmt
 from pypy.interpreter.gateway import interp2app, unwrap_spec


         assert (array([[1,2],[3,4]]).prod(1) == [2, 12]).all()
     def test_prod(self):
-        from numpypy import array, int_, dtype
+        from numpypy import array, dtype
         a = array(range(1, 6))
         assert == 120.0
         assert a[:4].prod() == 24.0
         for dt in ['bool', 'int8', 'uint8', 'int16', 'uint16']:
             a = array([True, False], dtype=dt)
             assert == 0
-            assert is dtype('uint' if dt[0] == 'u' else 'int')
  1. Brian Kearns

    This test was broken for a reason. If you check the dtype.char or dtype.num it is not maintained as expected, thus is fails, but they still compare equal. We want to make sure char/num are preserved as in numpy, so the is comparison was useful. Please take more care when blindly 'fixing' test failures by just modifying the test.

    1. mattip author

      So the test should either have had a comment what the problem is, or fail in such a way to indicate the problem In any case, the test was failing for numpy as well.

+            assert == dtype('uint' if dt[0] == 'u' else 'int')
         for dt in ['l', 'L', 'q', 'Q', 'e', 'f', 'd', 'F', 'D']:
             a = array([True, False], dtype=dt)
             assert == 0
-            assert is dtype(dt)
+            assert == dtype(dt)
  1. Brian Kearns

    Specifically, here, where a.dtype.char == q should return result with dtype.char == q. Putting == allows a return result with dtype.char == l to pass, which is wrong.

     def test_max(self):
         from numpypy import array, zeros