Skip to content

Commit

Permalink
Add parity variant for log matching test
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjw committed Aug 6, 2018
1 parent 050fe37 commit 79b2970
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/integration/parity/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def test_eth_getTransactionReceipt_unmined(self, web3, unlocked_account):
assert receipt is not None
assert receipt['blockHash'] is None

def test_eth_getLogs_with_logs_none_topic_args(self, web3):
pytest.xfail("Parity matches None to asbent values")
super().test_eth_getLogs_with_logs_none_topic_args(web3)

@flaky(max_runs=MAX_FLAKY_RUNS)
def test_eth_call_old_contract_state(self, web3, math_contract, unlocked_account):
start_block = web3.eth.getBlock('latest')
Expand Down
21 changes: 20 additions & 1 deletion web3/utils/module_testing/eth_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,25 @@ def assert_contains_log(result):
"fromBlock": 0,
"address": emitter_contract_address,
}
# Test with topic arguments

def test_eth_getLogs_with_logs_topic_args(
self,
web3,
block_with_txn_with_log,
emitter_contract_address,
txn_hash_with_log):
def assert_contains_log(result):
assert len(result) == 1
log_entry = result[0]
assert log_entry['blockNumber'] == block_with_txn_with_log['number']
assert log_entry['blockHash'] == block_with_txn_with_log['hash']
assert log_entry['logIndex'] == 0
assert is_same_address(log_entry['address'], emitter_contract_address)
assert log_entry['transactionIndex'] == 0
assert log_entry['transactionHash'] == HexBytes(txn_hash_with_log)

# Test with None event sig

filter_params = {
"fromBlock": 0,
"topics": [
Expand All @@ -741,6 +757,9 @@ def assert_contains_log(result):
result = web3.eth.getLogs(filter_params)
assert_contains_log(result)

def test_eth_getLogs_with_logs_none_topic_args(
self,
web3):
# Test with None overflowing
filter_params = {
"fromBlock": 0,
Expand Down

0 comments on commit 79b2970

Please sign in to comment.