You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monero-python/tests/test_base58.py

24 lines
705 B

import unittest
from monero.base58 import decode, encode
class Base58EncodeTestCase(unittest.TestCase):
def test_encode_empty(self):
self.assertEqual(encode(""), "")
def test_encode_invalid_hex_length(self):
with self.assertRaises(ValueError) as cm:
encode("abcde")
self.assertEqual(str(cm.exception), "Hex string has invalid length: 5")
class Base58DecodeTestCase(unittest.TestCase):
def test_decode_empty(self):
self.assertEqual(decode(""), "")
def test_decode_invalid_length_block(self):
with self.assertRaises(ValueError) as cm:
decode("f")
self.assertEqual(str(cm.exception), "Invalid encoded length: 1")