diff --git a/tests/expandingbloom_test.py b/tests/expandingbloom_test.py index f065dde..e0ce310 100755 --- a/tests/expandingbloom_test.py +++ b/tests/expandingbloom_test.py @@ -15,7 +15,7 @@ from probables import ExpandingBloomFilter, RotatingBloomFilter from probables.exceptions import RotatingBloomFilterError -from tests.utilities import calc_file_md5 +from tests.utilities import calc_file_md5, different_hash DELETE_TEMP_FILES = True @@ -38,6 +38,13 @@ def test_ebf_add_lots(self): blm.add("{}".format(i), True) self.assertEqual(blm.expansions, 9) + def test_ebf_add_lots_diff_hash(self): + """test adding "lots" of elements to force the expansion using a different hash""" + blm = ExpandingBloomFilter(est_elements=10, false_positive_rate=0.05, hash_function=different_hash) + for i in range(100): + blm.add("{}".format(i), True) + self.assertEqual(blm.expansions, 9) + def test_ebf_add_lots_without_force(self): """testing adding "lots" but force them to be inserted multiple times""" blm = ExpandingBloomFilter(est_elements=10, false_positive_rate=0.05)