def test_in1d_invert(self):
        # Test in1d's invert parameter
        a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1])
        b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1])
        assert_equal(np.invert(in1d(a, b)), in1d(a, b, invert=True))

        a = array([5, 5, 2, 1, -1], mask=[0, 0, 0, 0, 1])
        b = array([1, 5, -1], mask=[0, 0, 1])
        assert_equal(np.invert(in1d(a, b)), in1d(a, b, invert=True))

        assert_array_equal([], in1d([], [], invert=True))
示例#2
0
    def test_in1d_invert(self):
        # Test in1d's invert parameter
        a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1])
        b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1])
        assert_equal(np.invert(in1d(a, b)), in1d(a, b, invert=True))

        a = array([5, 5, 2, 1, -1], mask=[0, 0, 0, 0, 1])
        b = array([1, 5, -1], mask=[0, 0, 1])
        assert_equal(np.invert(in1d(a, b)), in1d(a, b, invert=True))

        assert_array_equal([], in1d([], [], invert=True))
 def test_in1d(self):
     # Test in1d
     a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1])
     b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1])
     test = in1d(a, b)
     assert_equal(test, [True, True, True, False, True])
     #
     a = array([5, 5, 2, 1, -1], mask=[0, 0, 0, 0, 1])
     b = array([1, 5, -1], mask=[0, 0, 1])
     test = in1d(a, b)
     assert_equal(test, [True, True, False, True, True])
     #
     assert_array_equal([], in1d([], []))
示例#4
0
 def test_in1d(self):
     # Test in1d
     a = array([1, 2, 5, 7, -1], mask=[0, 0, 0, 0, 1])
     b = array([1, 2, 3, 4, 5, -1], mask=[0, 0, 0, 0, 0, 1])
     test = in1d(a, b)
     assert_equal(test, [True, True, True, False, True])
     #
     a = array([5, 5, 2, 1, -1], mask=[0, 0, 0, 0, 1])
     b = array([1, 5, -1], mask=[0, 0, 1])
     test = in1d(a, b)
     assert_equal(test, [True, True, False, True, True])
     #
     assert_array_equal([], in1d([], []))