Skip to content

Commit 9435474

Browse files
committed
Minor update to docstrings for #3216
1 parent 5af6781 commit 9435474

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

web3/_utils/error_formatters_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def raise_contract_logic_error_on_revert(response: RPCResponse) -> RPCResponse:
169169

170170
def raise_transaction_indexing_error_if_indexing(response: RPCResponse) -> RPCResponse:
171171
"""
172-
Raise an error if ``eth_getTransactionReceipt`` returns a response indicating that
172+
Raise an error if ``eth_getTransactionReceipt`` returns an error indicating that
173173
transactions are still being indexed.
174174
"""
175175

web3/_utils/module_testing/utils.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,21 @@ def test_my_w3(w3, request_mocker):
4949
5050
async def test_my_w3(async_w3, request_mocker):
5151
def _iter_responses():
52-
yield {"error": {"code": -32000, "message": "indexing in progress"}}
53-
yield {"error": {"code": -32000, "message": "indexing in progress"}}
54-
yield {"result": "0x1"}
52+
while True:
53+
yield {"error": {"message": "transaction indexing in progress"}}
54+
yield {"error": {"message": "transaction indexing in progress"}}
55+
yield {"result": {"status": "0x1"}}
5556
5657
iter_responses = _iter_responses()
5758
5859
async with request_mocker(
5960
async_w3,
60-
mock_responses={"eth_getTransactionReceipt": next(iter_responses)}
61+
mock_responses={
62+
"eth_getTransactionReceipt": lambda *_: next(iter_responses)
63+
},
6164
):
65+
# assert that the first two error responses are handled and the result
66+
# is eventually returned when present
6267
assert await w3.eth.get_transaction_receipt("0x1") == "0x1"
6368
6469
@@ -85,9 +90,9 @@ def __init__(
8590
self.mock_results = mock_results or {}
8691
self.mock_errors = mock_errors or {}
8792
self.mock_responses = mock_responses or {}
88-
self._make_request: Union["AsyncMakeRequestFn", "MakeRequestFn"] = (
89-
w3.provider.make_request
90-
)
93+
self._make_request: Union[
94+
"AsyncMakeRequestFn", "MakeRequestFn"
95+
] = w3.provider.make_request
9196

9297
def __enter__(self) -> "Self":
9398
setattr(self.w3.provider, "make_request", self._mock_request_handler)

0 commit comments

Comments
 (0)