

def test_distanceCalculation(self):
    ridone = hashlib.sha1(str(random.getrandbits(255)))
    ridtwo = hashlib.sha1(str(random.getrandbits(255)))
    shouldbe = (int(ridone.hexdigest(), 16) ^ int(ridtwo.hexdigest(), 16))
    none = Node(ridone.digest())
    ntwo = Node(ridtwo.digest())
    self.assertEqual(none.distanceTo(ntwo), shouldbe)

dataset/ETHPy150Open OpenBazaar/OpenBazaar-Server/dht/tests/test_node.py NodeTest.test_distanceCalculation/original