[pypy-commit] pypy default: make these tests use array comparison, not loops
MichaelBlume
noreply at buildbot.pypy.org
Mon Mar 12 22:49:29 CET 2012
Author: Mike Blume <mike at loggly.com>
Branch:
Changeset: r53359:1f9c5203542f
Date: 2012-03-12 14:42 -0700
http://bitbucket.org/pypy/pypy/changeset/1f9c5203542f/
Log: make these tests use array comparison, not loops
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
@@ -636,8 +636,7 @@
a = array(range(1, 6), dtype=bool)
b = a // a
assert b.dtype is dtype("int8")
- for i in range(5):
- assert b[i] == 1
+ assert (b == [1, 1, 1, 1, 1]).all()
a = array([-1, 0, 1])
b = array([0, 0, 0])
@@ -662,22 +661,19 @@
a = array(range(5))
b = array([2, 2, 2, 2, 2], float)
c = a // b
- for i in range(5):
- assert c[i] == i // 2
+ assert (c == [0, 0, 1, 1, 2]).all()
def test_rfloordiv(self):
from _numpypy import array
a = array(range(1, 6))
b = 3 // a
- for i in range(5):
- assert b[i] == 3 // a[i]
+ assert (b == [3, 1, 1, 0, 0]).all()
def test_floordiv_constant(self):
from _numpypy import array
a = array(range(5))
b = a // 5
- for i in range(5):
- assert b[i] == i // 5
+ assert (b == [0, 0, 0, 0, 0]).all()
def test_truediv(self):
from operator import truediv
More information about the pypy-commit
mailing list