Ejemplo n.º 1
0
    def testHashSpaceLookupsAreValidTargets(self):
        targets = ["target" + str(i) for i in range(1, 10)]

        hashSpace = Flexihash()
        hashSpace.addTargets(targets)

        for i in range(1, 10):
            self.assertTrue(hashSpace.lookup("r"+str(i)) in targets, 'target must be in list of targets')
Ejemplo n.º 2
0
    def testHashSpaceLookupsAreValidTargets(self):
        targets = ["target" + str(i) for i in range(1, 10)]

        hashSpace = Flexihash()
        hashSpace.addTargets(targets)

        for i in range(1, 10):
            self.assertTrue(
                hashSpace.lookup("r" + str(i)) in targets,
                'target must be in list of targets')
Ejemplo n.º 3
0
    def testAddTargetsAndGetAllTargets(self):
        targets = ['t-a', 't-b', 't-c']

        hashSpace = Flexihash()
        hashSpace.addTargets(targets)
        self.assertEqual(hashSpace.getAllTargets(), targets)
Ejemplo n.º 4
0
    def testAddTargetsAndGetAllTargets(self):
        targets = ['t-a', 't-b', 't-c']

        hashSpace = Flexihash()
        hashSpace.addTargets(targets)
        self.assertEqual(hashSpace.getAllTargets(), targets)