summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_recfunctions.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-03-09 12:56:20 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-03-09 12:56:20 +0000
commit4b6277c682e0ba293c008ecdbe77473fa9e1d259 (patch)
tree6c1ef14a53fb972375c895a0b08223f9ab88cfe3 /numpy/lib/tests/test_recfunctions.py
parentc2bb0f9a1d5e3d58b7bc35142167a0d76e0e590b (diff)
downloadnumpy-4b6277c682e0ba293c008ecdbe77473fa9e1d259.tar.gz
Sort index of find_duplicated before testing, because the exact order is undefined for identical entries.
Diffstat (limited to 'numpy/lib/tests/test_recfunctions.py')
-rw-r--r--numpy/lib/tests/test_recfunctions.py31
1 files changed, 14 insertions, 17 deletions
diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py
index 424d60ae4..48a815d35 100644
--- a/numpy/lib/tests/test_recfunctions.py
+++ b/numpy/lib/tests/test_recfunctions.py
@@ -138,7 +138,7 @@ class TestRecFunctions(TestCase):
assert_equal(test, control)
- @np.testing.dec.knownfailureif(sys.platform=='win32', "Fail on Win32")
+ #@np.testing.dec.knownfailureif(sys.platform=='win32', "Fail on Win32")
def test_find_duplicates(self):
"Test find_duplicates"
a = ma.array([(2, (2., 'B')), (1, (2., 'B')), (2, (2., 'B')),
@@ -149,31 +149,31 @@ class TestRecFunctions(TestCase):
#
test = find_duplicates(a, ignoremask=False, return_index=True)
control = [0, 2]
- assert_equal(test[-1], control)
- assert_equal(test[0], a[control])
+ assert_equal(sorted(test[-1]), control)
+ assert_equal(test[0], a[test[-1]])
#
test = find_duplicates(a, key='A', return_index=True)
- control = [1, 3, 0, 2, 5]
- assert_equal(test[-1], control)
- assert_equal(test[0], a[control])
+ control = [0, 1, 2, 3, 5]
+ assert_equal(sorted(test[-1]), control)
+ assert_equal(test[0], a[test[-1]])
#
test = find_duplicates(a, key='B', return_index=True)
control = [0, 1, 2, 4]
- assert_equal(test[-1], control)
+ assert_equal(sorted(test[-1]), control)
assert_equal(test[0], a[control])
#
test = find_duplicates(a, key='BA', return_index=True)
control = [0, 1, 2, 4]
- assert_equal(test[-1], control)
+ assert_equal(sorted(test[-1]), control)
assert_equal(test[0], a[control])
#
test = find_duplicates(a, key='BB', return_index=True)
control = [0, 1, 2, 3, 4]
- assert_equal(test[-1], control)
+ assert_equal(sorted(test[-1]), control)
assert_equal(test[0], a[control])
- @np.testing.dec.knownfailureif(sys.platform=='win32', "Fail on Win32")
+ #@np.testing.dec.knownfailureif(sys.platform=='win32', "Fail on Win32")
def test_find_duplicates_ignoremask(self):
"Test the ignoremask option of find_duplicates"
ndtype = [('a', int)]
@@ -181,15 +181,12 @@ class TestRecFunctions(TestCase):
mask=[0, 0, 1, 0, 0, 0, 1]).view(ndtype)
test = find_duplicates(a, ignoremask=True, return_index=True)
control = [0, 1, 3, 4]
- assert_equal(test[-1], control)
- assert_equal(test[0], a[control])
+ assert_equal(sorted(test[-1]), control)
+ assert_equal(test[0], a[test[-1]])
#
test = find_duplicates(a, ignoremask=False, return_index=True)
- control = [0, 1, 3, 4, 6, 2]
- try:
- assert_equal(test[-1], control)
- except AssertionError:
- assert_equal(test[-1], [0, 1, 3, 4, 2, 6])
+ control = [0, 1, 2, 3, 4, 6]
+ assert_equal(sorted(test[-1]), control)
assert_equal(test[0], a[control])