Skip to content

Commit 79b2970

Browse files
committed
Add parity variant for log matching test
1 parent 050fe37 commit 79b2970

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

tests/integration/parity/common.py

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def test_eth_getTransactionReceipt_unmined(self, web3, unlocked_account):
9797
assert receipt is not None
9898
assert receipt['blockHash'] is None
9999

100+
def test_eth_getLogs_with_logs_none_topic_args(self, web3):
101+
pytest.xfail("Parity matches None to asbent values")
102+
super().test_eth_getLogs_with_logs_none_topic_args(web3)
103+
100104
@flaky(max_runs=MAX_FLAKY_RUNS)
101105
def test_eth_call_old_contract_state(self, web3, math_contract, unlocked_account):
102106
start_block = web3.eth.getBlock('latest')

web3/utils/module_testing/eth_module.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -718,9 +718,25 @@ def assert_contains_log(result):
718718
"fromBlock": 0,
719719
"address": emitter_contract_address,
720720
}
721-
# Test with topic arguments
721+
722+
def test_eth_getLogs_with_logs_topic_args(
723+
self,
724+
web3,
725+
block_with_txn_with_log,
726+
emitter_contract_address,
727+
txn_hash_with_log):
728+
def assert_contains_log(result):
729+
assert len(result) == 1
730+
log_entry = result[0]
731+
assert log_entry['blockNumber'] == block_with_txn_with_log['number']
732+
assert log_entry['blockHash'] == block_with_txn_with_log['hash']
733+
assert log_entry['logIndex'] == 0
734+
assert is_same_address(log_entry['address'], emitter_contract_address)
735+
assert log_entry['transactionIndex'] == 0
736+
assert log_entry['transactionHash'] == HexBytes(txn_hash_with_log)
722737

723738
# Test with None event sig
739+
724740
filter_params = {
725741
"fromBlock": 0,
726742
"topics": [
@@ -741,6 +757,9 @@ def assert_contains_log(result):
741757
result = web3.eth.getLogs(filter_params)
742758
assert_contains_log(result)
743759

760+
def test_eth_getLogs_with_logs_none_topic_args(
761+
self,
762+
web3):
744763
# Test with None overflowing
745764
filter_params = {
746765
"fromBlock": 0,

0 commit comments

Comments
 (0)