Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kclowes committed Jun 22, 2021
1 parent 01b6525 commit d343fe9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions web3/_utils/module_testing/net_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,23 @@ def test_net_chainId_deprecation(self, web3: "Web3") -> None:
with pytest.raises(DeprecationWarning):
web3.net.chainId


class AsyncNetModuleTest:
@pytest.mark.asyncio
async def test_net_version(self, async_w3: "Web3") -> None:
version = await async_w3.net.version
version = await async_w3.net.version # type: ignore

assert is_string(version)
assert version.isdigit()

@pytest.mark.asyncio
async def test_net_listening(self, async_w3: "Web3") -> None:
listening = await async_w3.net.listening
listening = await async_w3.net.listening # type: ignore

assert is_boolean(listening)

@pytest.mark.asyncio
async def test_net_peer_count(self, async_w3: "Web3") -> None:
peer_count = await async_w3.net.peer_count
peer_count = await async_w3.net.peer_count # type: ignore

assert is_integer(peer_count)
17 changes: 9 additions & 8 deletions web3/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class BaseNet(Module):
mungers=[default_root_munger],
)


class Net(BaseNet):
@property
def listening(self) -> bool:
Expand All @@ -41,10 +42,6 @@ def listening(self) -> bool:
def peer_count(self) -> int:
return self._peer_count()

@property
def peerCount(self) -> int:
return self._peer_count()

@property
def chainId(self) -> NoReturn:
raise DeprecationWarning("This method has been deprecated in EIP 1474.")
Expand All @@ -56,19 +53,23 @@ def version(self) -> str:
#
# Deprecated Methods
#
peerCount = DeprecatedMethod(peer_count, 'peerCount', 'peer_count')
peerCount = DeprecatedMethod(peer_count, 'peerCount', 'peer_count') # type: ignore


class AsyncNet(BaseNet):
is_async = True

@property
async def listening(self) -> bool:
return await self._listening()
# types ignored b/c mypy conflict with BlockingNet properties
return await self._listening() # type: ignore

@property
async def peer_count(self) -> int:
return await self._peer_count()
# types ignored b/c mypy conflict with BlockingNet properties
return await self._peer_count() # type: ignore

@property
async def version(self) -> str:
return await self._version()
# types ignored b/c mypy conflict with BlockingNet properties
return await self._version() # type: ignore

0 comments on commit d343fe9

Please sign in to comment.