Ejemplo n.º 1
0
 def test_clamp(self, multi):
     a, b = sorted(sample(multi[0], 2))
     ref = set.intersection(*[set(x) for x in multi]) & set(range(a, b))
     mrb = MultiRoaringBitmap([RoaringBitmap(x) for x in multi])
     rb = mrb.intersection(list(range(len(mrb))), start=a, stop=b)
     assert a <= rb.min() and rb.max() < b
     assert ref == rb
Ejemplo n.º 2
0
 def test_none(self, multi):
     orig = [RoaringBitmap(a) for a in multi]
     orig.insert(4, RoaringBitmap())
     mrb = MultiRoaringBitmap(orig)
     assert len(orig) == len(mrb)
     for rb1, rb2 in zip(orig, mrb):
         assert rb1 == rb2
     assert mrb.intersection([4, 5]) is None
Ejemplo n.º 3
0
	def test_clamp(self, multi):
		a, b = sorted(random.sample(multi[0], 2))
		ref = set.intersection(
				*[set(x) for x in multi]) & set(range(a, b))
		mrb = MultiRoaringBitmap([RoaringBitmap(x) for x in multi])
		rb = mrb.intersection(list(range(len(mrb))), start=a, stop=b)
		assert a <= rb.min() and rb.max() < b
		assert ref == rb
Ejemplo n.º 4
0
	def test_none(self, multi):
		orig = [RoaringBitmap(a) for a in multi]
		orig.insert(4, None)
		mrb = MultiRoaringBitmap(orig)
		assert len(orig) == len(mrb)
		for rb1, rb2 in zip(orig, mrb):
			assert rb1 == rb2
		assert mrb.intersection([4, 5]) is None
Ejemplo n.º 5
0
 def test_aggregateand(self, multi):
     ref = set(multi[0])
     res1 = ref.intersection(*[set(a) for a in multi[1:]])
     mrb = MultiRoaringBitmap([ImmutableRoaringBitmap(a) for a in multi])
     res2 = mrb.intersection(list(range(len(mrb))))
     assert res1 == res2
Ejemplo n.º 6
0
	def test_aggregateand(self, multi):
		ref = set(multi[0])
		res1 = ref.intersection(*[set(a) for a in multi[1:]])
		mrb = MultiRoaringBitmap([ImmutableRoaringBitmap(a) for a in multi])
		res2 = mrb.intersection(list(range(len(mrb))))
		assert res1 == res2