Skip to content

Commit

Permalink
Minor update to docstrings for #3216
Browse files Browse the repository at this point in the history
  • Loading branch information
fselmo committed Feb 1, 2024
1 parent 5af6781 commit 9435474
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion web3/_utils/error_formatters_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def raise_contract_logic_error_on_revert(response: RPCResponse) -> RPCResponse:

def raise_transaction_indexing_error_if_indexing(response: RPCResponse) -> RPCResponse:
"""
Raise an error if ``eth_getTransactionReceipt`` returns a response indicating that
Raise an error if ``eth_getTransactionReceipt`` returns an error indicating that
transactions are still being indexed.
"""

Expand Down
19 changes: 12 additions & 7 deletions web3/_utils/module_testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,21 @@ def test_my_w3(w3, request_mocker):
async def test_my_w3(async_w3, request_mocker):
def _iter_responses():
yield {"error": {"code": -32000, "message": "indexing in progress"}}
yield {"error": {"code": -32000, "message": "indexing in progress"}}
yield {"result": "0x1"}
while True:
yield {"error": {"message": "transaction indexing in progress"}}
yield {"error": {"message": "transaction indexing in progress"}}
yield {"result": {"status": "0x1"}}
iter_responses = _iter_responses()
async with request_mocker(
async_w3,
mock_responses={"eth_getTransactionReceipt": next(iter_responses)}
mock_responses={
"eth_getTransactionReceipt": lambda *_: next(iter_responses)
},
):
# assert that the first two error responses are handled and the result
# is eventually returned when present
assert await w3.eth.get_transaction_receipt("0x1") == "0x1"
Expand All @@ -85,9 +90,9 @@ def __init__(
self.mock_results = mock_results or {}
self.mock_errors = mock_errors or {}
self.mock_responses = mock_responses or {}
self._make_request: Union["AsyncMakeRequestFn", "MakeRequestFn"] = (
w3.provider.make_request
)
self._make_request: Union[
"AsyncMakeRequestFn", "MakeRequestFn"
] = w3.provider.make_request

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

0 comments on commit 9435474

Please sign in to comment.