Ejemplo n.º 1
0
 def test_construction_bad_value(self):
     with self.assertRaises(ValueError):
         CuckooHash(-1)
     with self.assertRaises(ValueError):
         CuckooHash(-1.0)
     with self.assertRaises(ValueError):
         CuckooHash(2.2)
Ejemplo n.º 2
0
 def setUp(self):
     self.hash_map = CuckooHash(5)
Ejemplo n.º 3
0
 def test_construction_valid_arg(self):
     self.assertEqual(3, CuckooHash(3.0).size)
     self.assertEqual(200, CuckooHash(200).size)
     self.assertEqual(0, CuckooHash(0).size)
     self.assertEqual(1000, CuckooHash(1000).size)
Ejemplo n.º 4
0
 def setUp(self):
     self.small_hash_map = CuckooHash(20)
     self.big_hash_map = CuckooHash(1000)
     self.alice_text = open('alice.txt', 'r').read()
Ejemplo n.º 5
0
 def test_construction_bad_type(self):
     with self.assertRaises(TypeError):
         CuckooHash('string')