Skip to content

Commit

Permalink
Fix xrb encode tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dourvaris committed Jan 24, 2018
1 parent 1b12767 commit 75fe224
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions raiblocks/accounts.py
Expand Up @@ -14,13 +14,8 @@
"""

import six
import string
from base64 import b32encode, b32decode
try:
maketrans = bytes.maketrans
except AttributeError:
import string
maketrans = string.maketrans


KNOWN_ACCOUNT_IDS = {
'xrb_3t6k35gi95xu6tergt6p69ck76ogmitsa8mnijtpxm9fkcm736xtoncuohr3': 'Genesis',
Expand All @@ -47,8 +42,10 @@
}


KNOWN_ACCOUNT_NAMES = dict((name, account) for account, name in KNOWN_ACCOUNT_IDS.items())
KNOWN_ACCOUNT_NAMES = dict(
(name, account) for account, name in KNOWN_ACCOUNT_IDS.items())

maketrans = bytes.maketrans if hasattr(bytes, 'maketrans') else string.maketrans
B32_ALPHABET = b'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
XRB_ALPHABET = b'13456789abcdefghijkmnopqrstuwxyz'
XRB_ENCODE_TRANS = maketrans(B32_ALPHABET, XRB_ALPHABET)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_accounts.py
Expand Up @@ -3,9 +3,9 @@


XRB_ENCODE_TESTS = [
('', ''),
('hello', 'f3kpru5h'),
('okay', 'fxop4ya='),
(b'', b''),
(b'hello', b'f3kpru5h'),
(b'okay', b'fxop4ya='),
]
XRB_DECODE_TESTS = [(encoded, decoded) for decoded, encoded in XRB_ENCODE_TESTS]

Expand Down

0 comments on commit 75fe224

Please sign in to comment.