def test_init_error_too_long(self): """ Attempting to create an address checksum longer than 9 trytes. """ with self.assertRaises(ValueError): # Extra padding characters are not ignored. # If it's an address checksum, it must be 9 trytes exactly. AddressChecksum(b'FOXM9MUBX9')
def test_init_happy_path(self): """ Creating a valid address checksum. """ self.assertEqual(binary_type(AddressChecksum(b'FOXM9MUBX')), b'FOXM9MUBX')
def test_init_error_too_short(self): """ Attempting to create an address checksum shorter than 9 trytes. """ with self.assertRaises(ValueError): AddressChecksum(b'FOXM9MUB')
def test_random(self): """ Creating a random AddressChecksum object. """ checksum = AddressChecksum.random() self.assertEqual(len(checksum), AddressChecksum.LEN)