diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2012-12-16 05:50:43 +0100 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2012-12-16 05:57:37 +0100 |
commit | b0ac985036918c39322e18d06bd69523cfef9e39 (patch) | |
tree | 995f13844aa416546456c4e93f41a5c20527a2d5 /numpy/lib/tests/test_arraysetops.py | |
parent | 6d3950c8ac3ad6088a473acc7d68ba405c14267c (diff) | |
download | numpy-b0ac985036918c39322e18d06bd69523cfef9e39.tar.gz |
TST: Add test for in1d ravelling
The behavior of in1d is not really defined here, but it should
be at least consistent over different execution branches. This is
what it has been for most usages.
Diffstat (limited to 'numpy/lib/tests/test_arraysetops.py')
-rw-r--r-- | numpy/lib/tests/test_arraysetops.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py index f7e7bfdca..5f4f10c76 100644 --- a/numpy/lib/tests/test_arraysetops.py +++ b/numpy/lib/tests/test_arraysetops.py @@ -189,6 +189,19 @@ class TestSetOps(TestCase): assert_array_equal(c, ec) + def test_in1d_ravel(self): + # Test that in1d ravels its input arrays. This is not documented + # behavior however. The test is to ensure consistentency. + a = np.arange(6).reshape(2,3) + b = np.arange(3,9).reshape(3,2) + long_b = np.arange(3, 63).reshape(30,2) + ec = np.array([False, False, False, True, True, True]) + + assert_array_equal(in1d(a, b, assume_unique=True), ec) + assert_array_equal(in1d(a, b, assume_unique=False), ec) + assert_array_equal(in1d(a, long_b, assume_unique=True), ec) + assert_array_equal(in1d(a, long_b, assume_unique=False), ec) + def test_union1d( self ): a = np.array( [5, 4, 7, 1, 2] ) b = np.array( [2, 4, 3, 3, 2, 1, 5] ) |