def test_checksum_valid(self): """ An address is created with a valid checksum. """ addy = Address(b'RVORZ9SIIP9RCYMREUIXXVPQIPHVCNPQ9HZWYKFWYWZRE' b'9JQKG9REPKIASHUUECPSQO9JT9XNMVKWYGVAFOXM9MUBX') self.assertTrue(addy.is_checksum_valid()) self.assertEqual( binary_type(addy.with_valid_checksum()), b'RVORZ9SIIP9RCYMREUIXXVPQIPHVCNPQ9HZWYKFWYWZRE' b'9JQKG9REPKIASHUUECPSQO9JT9XNMVKWYGVAFOXM9MUBX')
def test_checksum_null(self): """ An address is created without a checksum. """ trytes = (b'ZKIUDZXQYQAWSHPKSAATJXPAQZPGYCDCQDRSMWWCGQJNI' b'PCOORMDRNREDUDKBMUYENYTFVUNEWDBAKXMV') addy = Address(trytes) self.assertFalse(addy.is_checksum_valid()) self.assertEqual( binary_type(addy.with_valid_checksum()), b'ZKIUDZXQYQAWSHPKSAATJXPAQZPGYCDCQDRSMWWCGQJNI' b'PCOORMDRNREDUDKBMUYENYTFVUNEWDBAKXMVSDPEKQPMM', )
def test_checksum_invalid(self): """ An address is created with an invalid checksum. """ trytes = (b'IGKUOZGEFNSVJXETLIBKRSUZAWMYSVDPMHGQPCETEFNZP' b'XSJLZMBLAWDRLUBWPIPKFNEPADIWMXMYYRKQ') addy = Address(trytes + b'IGUKNUNAX' # <- Last tryte s/b 'W'. ) self.assertFalse(addy.is_checksum_valid()) self.assertEqual( binary_type(addy.with_valid_checksum()), b'IGKUOZGEFNSVJXETLIBKRSUZAWMYSVDPMHGQPCETEFNZP' b'XSJLZMBLAWDRLUBWPIPKFNEPADIWMXMYYRKQIGUKNUNAW', )