def test___repr__non_default_empty_tree(): tree = MerkleTree(hash_type='sha512', encoding='UTF-32', security=False) assert tree.__repr__() == '\n uuid : %s\ \n\ \n hash-type : SHA512\ \n encoding : UTF-32\ \n security : DEACTIVATED\ \n\ \n root-hash : [None]\ \n\ \n length : 0\ \n size : 0\ \n height : 0\n' % tree.uuid
def test___repr__default_non_empty_tree(): tree = MerkleTree(b'first', b'second', b'third') assert tree.__repr__() == '\n uuid : %s\ \n\ \n hash-type : SHA256\ \n encoding : UTF-8\ \n security : ACTIVATED\ \n\ \n root-hash : %s\ \n\ \n length : 3\ \n size : 5\ \n height : 2\n' % (tree.uuid, tree.rootHash.decode(tree.encoding))