<s> import unittest <EOL> from pycoin . ecdsa import public_pair_for_secret_exponent , generator_secp256k1 <EOL> from pycoin . encoding import bitcoin_address_to_hash160_sec , is_sec_compressed , public_pair_to_sec , secret_exponent_to_wif , public_pair_to_bitcoin_address , wif_to_tuple_of_secret_exponent_compressed , sec_to_public_pair , public_pair_to_hash160_sec <EOL> from pycoin . serialize import h2b <EOL> """<STR_LIT>""" <EOL> class BuildTxTest ( unittest . TestCase ) : <EOL> def test_translation ( self ) : <EOL> def do_test ( exp_hex , wif , c_wif , public_pair_sec , c_public_pair_sec , address_b58 , c_address_b58 ) : <EOL> secret_exponent = int ( exp_hex , <NUM_LIT:16> ) <EOL> sec = h2b ( public_pair_sec ) <EOL> c_sec = h2b ( c_public_pair_sec ) <EOL> self . assertEqual ( secret_exponent_to_wif ( secret_exponent , compressed = False ) , wif ) <EOL> self . assertEqual ( secret_exponent_to_wif ( secret_exponent , compressed = True ) , c_wif ) <EOL> exponent , compressed = wif_to_tuple_of_secret_exponent_compressed ( wif ) <EOL> self . assertEqual ( exponent , secret_exponent ) <EOL> self . assertFalse ( compressed ) <EOL> exponent , compressed = wif_to_tuple_of_secret_exponent_compressed ( c_wif ) <EOL> self . assertEqual ( exponent , secret_exponent ) <EOL> self . assertTrue ( compressed ) <EOL> public_pair = public_pair_for_secret_exponent ( generator_secp256k1 , secret_exponent ) <EOL> pk_public_pair = sec_to_public_pair ( sec ) <EOL> compressed = is_sec_compressed ( sec ) <EOL> self . assertEqual ( pk_public_pair , public_pair ) <EOL> self . assertFalse ( is_sec_compressed ( sec ) ) <EOL> self . assertEqual ( public_pair_to_sec ( pk_public_pair , compressed = False ) , sec ) <EOL> pk_public_pair = sec_to_public_pair ( c_sec ) <EOL> compressed = is_sec_compressed ( c_sec ) <EOL> self . assertEqual ( pk_public_pair , public_pair ) <EOL> self . assertTrue ( compressed ) <EOL> self . assertEqual ( public_pair_to_sec ( pk_public_pair , compressed = True ) , c_sec ) <EOL> bca = public_pair_to_bitcoin_address ( pk_public_pair , compressed = True ) <EOL> self . assertEqual ( bca , c_address_b58 ) <EOL> self . assertEqual ( bitcoin_address_to_hash160_sec ( c_address_b58 ) , public_pair_to_hash160_sec ( pk_public_pair , compressed = True ) ) <EOL> bca = public_pair_to_bitcoin_address ( pk_public_pair , compressed = False ) <EOL> self . assertEqual ( bca , address_b58 ) <EOL> self . assertEqual ( bitcoin_address_to_hash160_sec ( address_b58 ) , public_pair_to_hash160_sec ( pk_public_pair , compressed = False ) ) <EOL> do_test ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> do_test ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> do_test ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> do_test ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
