def test_symmetric_difference_update(self): bitmap_set = NdBitmapSet(_shape, elems=[_a, _b, _c]) other = NdBitmapSet(_shape, elems=[_b, _c, _d]) expected = NdBitmapSet(_shape, elems=[_a, _d]) actual = bitmap_set.copy() actual.symmetric_difference_update(other) self.assertNdBitmapSetEqual(actual, expected) actual = bitmap_set.copy() actual ^= other self.assertNdBitmapSetEqual(actual, expected)
def test_intersection_update(self): bitmap_set = NdBitmapSet(_shape, elems=[_a, _b, _c]) other = NdBitmapSet(_shape, elems=[_b, _c, _d]) expected = NdBitmapSet(_shape, elems=[_b, _c]) actual = bitmap_set.copy() actual.intersection_update(other) self.assertNdBitmapSetEqual(actual, expected) actual = bitmap_set.copy() actual &= other self.assertNdBitmapSetEqual(actual, expected)
def test_copy(self): bitmap_set = NdBitmapSet(_shape, elems=[_a, _b, _c]) other = bitmap_set.copy() self.assertTrue(bitmap_set == other) # copy is a distinct object self.assertTrue(id(bitmap_set) != id(other)) bitmap_set.add(_d) other.remove(_c) self.assertTrue(bitmap_set != other)