<s> import unittest <EOL> from decimal import Decimal <EOL> from ngcccbase . services . blockchain import BlockchainInfoInterface , AbeInterface <EOL> from ngcccbase . services . electrum import ( ConnectionError , <EOL> ElectrumInterface , EnhancedBlockchainState ) <EOL> class TestElectrum ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . server_url = "<STR_LIT>" <EOL> self . ei = ElectrumInterface ( self . server_url , <NUM_LIT> ) <EOL> self . bcs = EnhancedBlockchainState ( self . server_url , <NUM_LIT> ) <EOL> self . txhash = '<STR_LIT>' <EOL> self . height = <NUM_LIT> <EOL> self . raw_tx = '<STR_LIT>' <EOL> self . address = '<STR_LIT>' <EOL> def test_connect ( self ) : <EOL> self . assertRaises ( ConnectionError , ElectrumInterface , '<STR_LIT>' , <NUM_LIT> ) <EOL> def test_get_utxo ( self ) : <EOL> self . assertEqual ( self . ei . get_utxo ( self . address ) , [ ] ) <EOL> def test_get_version ( self ) : <EOL> self . assertTrue ( Decimal ( self . ei . get_version ( ) ) >= <NUM_LIT> ) <EOL> def test_get_height ( self ) : <EOL> self . assertTrue ( self . ei . get_height ( ) > <NUM_LIT> ) <EOL> def test_get_header ( self ) : <EOL> result = self . bcs . get_header ( self . height ) <EOL> self . assertEqual ( <EOL> result [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' ) <EOL> def test_get_merkle ( self ) : <EOL> result = self . bcs . get_merkle ( self . txhash ) <EOL> self . assertEqual ( <EOL> result [ '<STR_LIT>' ] [ <NUM_LIT:0> ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( <EOL> result [ '<STR_LIT>' ] [ - <NUM_LIT:1> ] , <EOL> '<STR_LIT>' ) <EOL> self . assertEqual ( result [ '<STR_LIT>' ] , <NUM_LIT:0> ) <EOL> self . assertEqual ( result [ '<STR_LIT>' ] , self . height ) <EOL> def test_get_raw_transaction ( self ) : <EOL> self . assertEqual ( self . ei . get_raw_transaction ( self . txhash , self . height ) , <EOL> self . raw_tx ) <EOL> self . assertEqual ( self . bcs . get_raw_transaction ( self . txhash ) , self . raw_tx ) <EOL> def test_get_block_height ( self ) : <EOL> self . assertEqual ( self . bcs . get_tx_block_height ( self . txhash ) [ <NUM_LIT:0> ] , self . height ) <EOL> def test_get_tx ( self ) : <EOL> self . assertEqual ( self . bcs . get_tx ( self . txhash ) . hash , self . txhash ) <EOL> class TestBlockchain ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . address = '<STR_LIT>' <EOL> self . txhash = '<STR_LIT>' <EOL> self . address2 = '<STR_LIT>' <EOL> def test_blockchain ( self ) : <EOL> self . assertEqual ( BlockchainInfoInterface . get_utxo ( self . address ) [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] , <EOL> self . txhash ) <EOL> self . assertEqual ( BlockchainInfoInterface . get_utxo ( self . address2 ) , [ ] ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
