| 1611 | assert_array_equal([], setxor1d([], [])) |
| 1612 | |
| 1613 | def test_isin(self): |
| 1614 | # the tests for in1d cover most of isin's behavior |
| 1615 | # if in1d is removed, would need to change those tests to test |
| 1616 | # isin instead. |
| 1617 | a = np.arange(24).reshape([2, 3, 4]) |
| 1618 | mask = np.zeros([2, 3, 4]) |
| 1619 | mask[1, 2, 0] = 1 |
| 1620 | a = array(a, mask=mask) |
| 1621 | b = array(data=[0, 10, 20, 30, 1, 3, 11, 22, 33], |
| 1622 | mask=[0, 1, 0, 1, 0, 1, 0, 1, 0]) |
| 1623 | ec = zeros((2, 3, 4), dtype=bool) |
| 1624 | ec[0, 0, 0] = True |
| 1625 | ec[0, 0, 1] = True |
| 1626 | ec[0, 2, 3] = True |
| 1627 | c = isin(a, b) |
| 1628 | assert_(isinstance(c, MaskedArray)) |
| 1629 | assert_array_equal(c, ec) |
| 1630 | #compare results of np.isin to ma.isin |
| 1631 | d = np.isin(a, b[~b.mask]) & ~a.mask |
| 1632 | assert_array_equal(c, d) |
| 1633 | |
| 1634 | def test_in1d(self): |
| 1635 | # Test in1d |