From 7fd35b73fcb090b197e2f574e2f1ab3d6308cde8 Mon Sep 17 00:00:00 2001 From: pacrob Date: Fri, 10 Dec 2021 10:05:34 -0700 Subject: [PATCH] update test name to be unique --- newsfragments/2243.doc.rst | 1 - web3/_utils/module_testing/eth_module.py | 3 ++- web3/eth.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 newsfragments/2243.doc.rst diff --git a/newsfragments/2243.doc.rst b/newsfragments/2243.doc.rst deleted file mode 100644 index a72f59efeb..0000000000 --- a/newsfragments/2243.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Update AsyncHTTPProvider doc Supported Methods to include ``web3.eth.hashrate``. \ No newline at end of file diff --git a/web3/_utils/module_testing/eth_module.py b/web3/_utils/module_testing/eth_module.py index 253e2b02cd..7d1c5ca4a8 100644 --- a/web3/_utils/module_testing/eth_module.py +++ b/web3/_utils/module_testing/eth_module.py @@ -680,12 +680,13 @@ async def test_eth_call_revert_without_msg( await async_w3.eth.call(txn_params) # type: ignore @pytest.mark.asyncio - async def test_eth_hashrate( + async def test_async_eth_hashrate( self, async_w3: "Web3" ) -> None: hashrate = await async_w3.eth.hashrate # type: ignore assert is_integer(hashrate) + assert hashrate >= 0 class EthModuleTest: diff --git a/web3/eth.py b/web3/eth.py index 564a30c369..1708c0d19c 100644 --- a/web3/eth.py +++ b/web3/eth.py @@ -340,6 +340,10 @@ async def coinbase(self) -> ChecksumAddress: # types ignored b/c mypy conflict with BlockingEth properties return await self.get_coinbase() # type: ignore + @property + async def hashrate(self) -> int: + return await self._get_hashrate() # type: ignore + _get_balance: Method[Callable[..., Awaitable[Wei]]] = Method( RPC.eth_getBalance, mungers=[BaseEth.block_id_munger], @@ -389,10 +393,6 @@ async def call( ) -> Union[bytes, bytearray]: return await self._call(transaction, block_identifier, state_override) - @property - async def hashrate(self) -> int: - return await self._get_hashrate() # type: ignore - class Eth(BaseEth, Module): account = Account()