test_accuracy.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:pyreBloom-ng 作者: leovp 项目源码 文件源码
def test_size_allocation(self):
        """Make sure we can allocate a bloom filter that would take more than
        512MB (the string size limit in Redis)"""
        included = sample_strings(20, 5000)
        excluded = sample_strings(20, 5000)

        # Add only the included strings
        self.bloom.update(included)
        self.assertEqual(len(included), len(self.bloom.intersection(included)))

        false_positives = self.bloom.intersection(excluded)
        false_rate = float(len(false_positives)) / len(excluded)
        self.assertTrue(false_rate <= 0.00001,
                        'False positive error rate exceeded!')

        # We also need to know that we can access all the keys we need
        self.assertEqual(self.bloom.keys(),
                         [b'pyreBloomTesting.0', b'pyreBloomTesting.1'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号