Missing async test coverage for edge cases in AsyncEthModuleTest (pending block tag, get_block variants)
- Dominant language
- Python
- Stars
- 5.5k
- Forks
- 1.7k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 2
Description
## Summary
While reviewing the test suite, I noticed that `AsyncEthModuleTest` in
`web3/_utils/module_testing/eth_module.py` lacks coverage for several edge
cases that are tested in the synchronous `EthModuleTest` counterpart.
Specifically, the following are either missing or incomplete in the async suite:
- `eth_getBlockByNumber` with the `"pending"` block tag
- `eth_getBlockByHash` with `full_transactions=True` edge cases
- Error handling when an invalid block identifier is passed to async block-fetching methods
These cases are handled in the sync suite but fail silently in async contexts
because the async methods are not exercised against them via `pytest-asyncio`
and the `Eth-Tester` backend.
## Why It Matters
Silent failures in async code are harder to catch than sync failures. As
`AsyncWeb3` usage grows, ensuring async/sync test parity is critical for
developer confidence and library reliability.
## Proposed Fix
- Add `pytest-asyncio` test functions to `AsyncEthModuleTest` covering the
above edge cases against the `EthereumTesterProvider` backend
- Add or correct `TypedDict` type hints for transaction dictionary parameters
where `mypy` currently raises warnings during `tox` runs
- Update relevant docstrings to reflect async behavior
## Environment
- web3.py: `main` branch
- Python: 3.11
- OS: Linux/macOS
- Tools: pytest, pytest-asyncio, tox, eth-tester
I plan to submit a PR addressing this. Happy to discuss scope before starting.
Contributor guide
Assessment
This issue has not been assessed yet.