Author: Brian Kearns <[email protected]>
Branch:
Changeset: r60996:5691aa9f6d83
Date: 2013-02-08 21:13 -0500
http://bitbucket.org/pypy/pypy/changeset/5691aa9f6d83/
Log: add numpy indexing by list test
diff --git a/lib_pypy/_collections.py b/lib_pypy/_collections.py
--- a/lib_pypy/_collections.py
+++ b/lib_pypy/_collections.py
@@ -142,12 +142,15 @@
return c
def remove(self, value):
- # Need to be defensive for mutating comparisons
for i in range(len(self)):
- if self[i] == value:
- del self[i]
- return
- raise ValueError("deque.remove(x): x not in deque")
+ elem = self.popleft()
+ if elem == value:
+ break
+ self.append(elem)
+ else:
+ raise ValueError("deque.remove(x): x not in deque")
+ for i in range(len(self) - i):
+ self.append(self.popleft())
def rotate(self, n=1):
length = len(self)
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
@@ -1595,6 +1595,12 @@
a[a<0] = -a[a<0]
assert (a == [1, 1]).all()
+ def test_int_list_index(slf):
+ from numpypy import array, arange
+ assert (array([10,11,12,13])[[1,2]] == [11, 12]).all()
+ assert (arange(6).reshape((2,3))[[0,1]] == [[0, 1, 2], [3, 4,
5]]).all()
+ assert arange(6).reshape((2,3))[(0,1)] == 1
+
def test_int_array_index(self):
from numpypy import array, arange, zeros
b = arange(10)[array([3, 2, 1, 5])]
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit