Esempio n. 1
0
    def test_size_and_num_hashes(self):
        'Test BloomFilter.size()'
        dilberts = BloomFilter(
            redis=self.redis,
            num_elements=100,
            false_positives=0.1,
        )
        assert dilberts.size() == 480
        assert dilberts.num_hashes() == 4

        dilberts = BloomFilter(
            redis=self.redis,
            num_elements=1000,
            false_positives=0.1,
        )
        assert dilberts.size() == 4793
        assert dilberts.num_hashes() == 4

        dilberts = BloomFilter(
            redis=self.redis,
            num_elements=100,
            false_positives=0.01,
        )
        assert dilberts.size() == 959
        assert dilberts.num_hashes() == 7

        dilberts = BloomFilter(
            redis=self.redis,
            num_elements=1000,
            false_positives=0.01,
        )
        assert dilberts.size() == 9586
        assert dilberts.num_hashes() == 7
Esempio n. 2
0
    def test_size_and_num_hashes(self):
        'Test BloomFilter.size()'
        dilberts = BloomFilter(num_values=100, false_positives=0.1)
        assert dilberts.size() == 480
        assert dilberts.num_hashes() == 4

        dilberts = BloomFilter(num_values=1000, false_positives=0.1)
        assert dilberts.size() == 4793
        assert dilberts.num_hashes() == 4

        dilberts = BloomFilter(num_values=100, false_positives=0.01)
        assert dilberts.size() == 959
        assert dilberts.num_hashes() == 7

        dilberts = BloomFilter(num_values=1000, false_positives=0.01)
        assert dilberts.size() == 9586
        assert dilberts.num_hashes() == 7
Esempio n. 3
0
    def test_size_and_num_hashes(self):
        'Test BloomFilter.size()'
        dilberts = BloomFilter(num_values=100, false_positives=0.1)
        assert dilberts.size() == 480
        assert dilberts.num_hashes() == 4

        dilberts = BloomFilter(num_values=1000, false_positives=0.1)
        assert dilberts.size() == 4793
        assert dilberts.num_hashes() == 4

        dilberts = BloomFilter(num_values=100, false_positives=0.01)
        assert dilberts.size() == 959
        assert dilberts.num_hashes() == 7

        dilberts = BloomFilter(num_values=1000, false_positives=0.01)
        assert dilberts.size() == 9586
        assert dilberts.num_hashes() == 7