summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_arraysetops.py
diff options
context:
space:
mode:
authorJulien Phalip <jphalip@gmail.com>2013-02-20 06:44:50 +0000
committerJulien Phalip <jphalip@gmail.com>2013-04-08 22:21:31 -0700
commita3f2e0461eeec2077e7ed1f71bf1e0756e893257 (patch)
tree89c1fb09c34519d907249293f3a7ef8ed587da5e /numpy/lib/tests/test_arraysetops.py
parentd1b195d943da80cafd42f935fa9ec920eb18c7e5 (diff)
downloadnumpy-a3f2e0461eeec2077e7ed1f71bf1e0756e893257.tar.gz
ENH: add `invert` parameter to numpy.in1d().
Diffstat (limited to 'numpy/lib/tests/test_arraysetops.py')
-rw-r--r--numpy/lib/tests/test_arraysetops.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py
index b3c608cf8..f7f75922d 100644
--- a/numpy/lib/tests/test_arraysetops.py
+++ b/numpy/lib/tests/test_arraysetops.py
@@ -190,6 +190,15 @@ class TestSetOps(TestCase):
assert_array_equal(c, ec)
+ def test_in1d_invert(self):
+ "Test in1d's invert parameter"
+ # We use two different sizes for the b array here to test the
+ # two different paths in in1d().
+ for mult in (1, 10):
+ a = np.array([5, 4, 5, 3, 4, 4, 3, 4, 3, 5, 2, 1, 5, 5])
+ b = [2, 3, 4] * mult
+ assert_array_equal(np.invert(in1d(a, b)), in1d(a, b, invert=True))
+
def test_in1d_ravel(self):
# Test that in1d ravels its input arrays. This is not documented
# behavior however. The test is to ensure consistentency.