示例#1
0
 def test_init_1_invalid_address(self):
     with pytest.raises(ValueError):
         my_account = ethdata.Account("0x0")
     with pytest.raises(ValueError):
         my_account = ethdata.Account(
             "0x0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X0X")
     with pytest.raises(ValueError):
         my_account = ethdata.Account(
             "a2381223639181689cd6c46d38a1a4884bb6d83c")
 def test_getter_12_transaction_without_data(self):
     my_account = ethdata.Account(
         "0xaa6c8f25f6027ff3fc27428ca86dc80202d702c0")
     my_account.query_range = {"start": "2019-01-31", "end": "2019-01-31"}
     assert len(my_account.transaction_receipts) == 3
     assert my_account.transaction_receipts.iloc[0][
         'function_signature'] == None
     assert my_account.transaction_receipts.iloc[0]['function_data'] == None
示例#3
0
 def test_setter_3_query_range(self):
     my_account = ethdata.Account("0x1cB424cB77B19143825004d0bd0a4BEE2c5e91A8")
     assert my_account.query_range == {}
     my_account.query_range = {"start": "2018-01-01", "end": "2018-01-02"}
     assert my_account.query_range == {"start": "2018-01-01", "end": "2018-01-02"}
     my_account.query_range = {"start": "2018-01-03"}
     assert my_account.query_range == {"start": "2018-01-03"}
     my_account.query_range = {"end": "2018-01-04"}
     assert my_account.query_range == {"end": "2018-01-04"}
     my_account.query_range = {"key": "value"}
     assert my_account.query_range == {}
示例#4
0
 def test_setter_1_address(self):
     my_account = ethdata.Account("0x1cB424cB77B19143825004d0bd0a4BEE2c5e91A8")
     assert my_account.address == "0x1cb424cb77b19143825004d0bd0a4bee2c5e91a8"
     with pytest.raises(ValueError):
         my_account.address = ""
示例#5
0
 def test_setter_2_transaction_receipts(self):
     my_account = ethdata.Account("0x1cB424cB77B19143825004d0bd0a4BEE2c5e91A8")
     my_account.transaction_receipts = "tx"
     assert my_account.transaction_receipts == "tx"
示例#6
0
 def test_init_3_valid_caps_address(self):
     my_account = ethdata.Account(
         "0x1cB424cB77B19143825004d0bd0a4BEE2c5e91A8")
     assert my_account.address == "0x1cb424cb77b19143825004d0bd0a4bee2c5e91a8"
     assert my_account.query_range == {}
示例#7
0
 def test_init_2_valid_address(self):
     my_account = ethdata.Account(
         "0xa2381223639181689cd6c46d38a1a4884bb6d83c")
     assert my_account.address == "0xa2381223639181689cd6c46d38a1a4884bb6d83c"
     assert my_account.query_range == {}
 def test_getter_2_no_tx(self):
     my_account = ethdata.Account(
         "0x1cB424cB77B19143825004d0bd0a4BEE2c5e91A8")
     my_account.query_range = {"start": "2019-01-01", "end": "2019-01-01"}
     assert len(my_account.transaction_receipts) == 0
 def test_getter_1_tx(self):
     my_account = ethdata.Account(
         "0xa2381223639181689cd6c46d38a1a4884bb6d83c")
     my_account.query_range = {"start": "2019-01-29", "end": "2019-01-29"}
     # On this date, there were 14 normal tx and 2 internal tx
     assert len(my_account.transaction_receipts) == 14