コード例 #1
0
 def test_bfod_check(self):
     """ ensure the use of check works on disk bloom """
     filename = "tmp.blm"
     blm = BloomFilterOnDisk(filename, 10, 0.05)
     blm.add("this is a test")
     blm.add("this is another test")
     self.assertEqual(blm.check("this is a test"), True)
     self.assertEqual(blm.check("this is another test"), True)
     self.assertEqual(blm.check("this is yet another test"), False)
     self.assertEqual(blm.check("this is not another test"), False)
     blm.close()
     os.remove(filename)
コード例 #2
0
 def test_bfod_check(self):
     ''' ensure the use of check works on disk bloom '''
     filename = 'tmp.blm'
     blm = BloomFilterOnDisk(filename, 10, 0.05)
     blm.add('this is a test')
     blm.add('this is another test')
     self.assertEqual(blm.check('this is a test'), True)
     self.assertEqual(blm.check('this is another test'), True)
     self.assertEqual(blm.check('this is yet another test'), False)
     self.assertEqual(blm.check('this is not another test'), False)
     blm.close()
     os.remove(filename)
コード例 #3
0
ファイル: bloom_test.py プロジェクト: barrust/pyprobables
 def test_bfod_check(self):
     ''' ensure the use of check works on disk bloom '''
     filename = 'tmp.blm'
     blm = BloomFilterOnDisk(filename, 10, 0.05)
     blm.add('this is a test')
     blm.add('this is another test')
     self.assertEqual(blm.check('this is a test'), True)
     self.assertEqual(blm.check('this is another test'), True)
     self.assertEqual(blm.check('this is yet another test'), False)
     self.assertEqual(blm.check('this is not another test'), False)
     blm.close()
     os.remove(filename)
コード例 #4
0
 def test_bfod_check(self):
     """ensure the use of check works on disk bloom"""
     with NamedTemporaryFile(dir=os.getcwd(),
                             suffix=".blm",
                             delete=DELETE_TEMP_FILES) as fobj:
         blm = BloomFilterOnDisk(fobj.name, 10, 0.05)
         blm.add("this is a test")
         blm.add("this is another test")
         self.assertEqual(blm.check("this is a test"), True)
         self.assertEqual(blm.check("this is another test"), True)
         self.assertEqual(blm.check("this is yet another test"), False)
         self.assertEqual(blm.check("this is not another test"), False)
         blm.close()