Skip to content

Commit

Permalink
TST: Add test for in1d ravelling
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
seberg committed Dec 16, 2012
1 parent 6d3950c commit b0ac985
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions numpy/lib/tests/test_arraysetops.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ def test_in1d_char_array( self ):

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] )
Expand Down

0 comments on commit b0ac985

Please sign in to comment.