-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Asyncify filters
- Loading branch information
Showing
33 changed files
with
2,449 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added async functionality to filter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import pytest | ||
|
||
import pytest_asyncio | ||
|
||
from web3 import Web3 | ||
from web3._utils.filters import ( | ||
AsyncBlockFilter, | ||
AsyncLogFilter, | ||
AsyncTransactionFilter, | ||
BlockFilter, | ||
LogFilter, | ||
TransactionFilter, | ||
) | ||
from web3.eth import ( | ||
AsyncEth, | ||
) | ||
from web3.providers.eth_tester.main import ( | ||
AsyncEthereumTesterProvider, | ||
) | ||
|
||
|
||
def test_Eth_filter_creates_correct_filter_type(w3): | ||
filter1 = w3.eth.filter("latest") | ||
assert isinstance(filter1, BlockFilter) | ||
filter2 = w3.eth.filter("pending") | ||
assert isinstance(filter2, TransactionFilter) | ||
filter3 = w3.eth.filter({}) | ||
assert isinstance(filter3, LogFilter) | ||
|
||
|
||
# --- async --- # | ||
|
||
|
||
@pytest_asyncio.fixture() | ||
async def async_w3(): | ||
provider = AsyncEthereumTesterProvider() | ||
w3 = Web3(provider, modules={"eth": [AsyncEth]}, middlewares=[]) | ||
return w3 | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_AsyncEth_filter_creates_correct_filter_type(async_w3): | ||
|
||
filter1 = await async_w3.eth.filter("latest") | ||
assert isinstance(filter1, AsyncBlockFilter) | ||
filter2 = await async_w3.eth.filter("pending") | ||
assert isinstance(filter2, AsyncTransactionFilter) | ||
filter3 = await async_w3.eth.filter({}) | ||
assert isinstance(filter3, AsyncLogFilter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.