Modify peer_id str
This commit is contained in:
parent
1250182e7c
commit
f9721a2ade
@ -27,7 +27,7 @@ class ID:
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
pid = self.pretty()
|
pid = self.pretty()
|
||||||
return "<peer.ID %s>" % pid
|
return pid
|
||||||
|
|
||||||
__repr__ = __str__
|
__repr__ = __str__
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ def test_str_less_than_10():
|
|||||||
for _ in range(5):
|
for _ in range(5):
|
||||||
random_id_string += random.SystemRandom().choice(ALPHABETS)
|
random_id_string += random.SystemRandom().choice(ALPHABETS)
|
||||||
pid = base58.b58encode(random_id_string).decode()
|
pid = base58.b58encode(random_id_string).decode()
|
||||||
expected = "<peer.ID " + pid + ">"
|
expected = pid
|
||||||
actual = ID(random_id_string).__str__()
|
actual = ID(random_id_string).__str__()
|
||||||
|
|
||||||
assert actual == expected
|
assert actual == expected
|
||||||
@ -46,7 +46,7 @@ def test_str_more_than_10():
|
|||||||
for _ in range(10):
|
for _ in range(10):
|
||||||
random_id_string += random.SystemRandom().choice(ALPHABETS)
|
random_id_string += random.SystemRandom().choice(ALPHABETS)
|
||||||
pid = base58.b58encode(random_id_string).decode()
|
pid = base58.b58encode(random_id_string).decode()
|
||||||
expected = "<peer.ID " + pid + ">"
|
expected = pid
|
||||||
actual = ID(random_id_string).__str__()
|
actual = ID(random_id_string).__str__()
|
||||||
|
|
||||||
assert actual == expected
|
assert actual == expected
|
||||||
|
Loading…
x
Reference in New Issue
Block a user