def test_intersection(self): bitmap_set = NdBitmapSet(_shape, elems=[_a, _b, _c]) other = NdBitmapSet(_shape, elems=[_b, _c, _d]) expected = NdBitmapSet(_shape, elems=[_b, _c]) self.assertNdBitmapSetEqual(bitmap_set.intersection(other), expected) self.assertNdBitmapSetEqual(bitmap_set & other, expected) self.assertNdBitmapSetEqual(other & bitmap_set, expected)
def test_intersection_multiple_others(self): bitmap_set = NdBitmapSet(_shape, elems=[_a, _b, _c]) others = [ NdBitmapSet(_shape, elems=[_a, _b]), NdBitmapSet(_shape, elems=[_a, _c]), NdBitmapSet(_shape, elems=[_a, _d]), ] expected = NdBitmapSet(_shape, elems=[_a]) self.assertNdBitmapSetEqual(bitmap_set.intersection(*others), expected)