Made trust distance test graph generation reliable
This commit is contained in:
parent
05e04ef557
commit
fae9521d8f
@ -29,8 +29,14 @@ def generate_graph(iden: Identity, depth, max_neighbors):
|
|||||||
class IdentityDistanceTest(unittest.TestCase):
|
class IdentityDistanceTest(unittest.TestCase):
|
||||||
def test_distance(self):
|
def test_distance(self):
|
||||||
iden = Identity(os.urandom(32), "1" + secrets.token_hex(4))
|
iden = Identity(os.urandom(32), "1" + secrets.token_hex(4))
|
||||||
generate_graph(iden, 10, 5)
|
while True:
|
||||||
iden2 = list(list(iden.trusted)[0].trusted)[0]
|
generate_graph(iden, 10, 5)
|
||||||
|
try:
|
||||||
|
iden2 = list(list(iden.trusted)[0].trusted)[0]
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
self.assertEqual(get_distance(iden, iden2), 2)
|
self.assertEqual(get_distance(iden, iden2), 2)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user