web3 7.12.0__tar.gz → 7.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {web3-7.12.0/web3.egg-info → web3-7.13.0}/PKG-INFO +1 -1
- {web3-7.12.0 → web3-7.13.0}/pyproject.toml +1 -1
- {web3-7.12.0 → web3-7.13.0}/setup.py +1 -1
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_accounts.py +4 -3
- web3-7.13.0/tests/core/middleware/test_formatting_middleware.py +236 -0
- web3-7.13.0/tests/core/subscriptions/test_subscription_manager.py +531 -0
- web3-7.13.0/tests/integration/geth-1.16.2-fixture.zip +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/conftest.py +3 -3
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/test_goethereum_http.py +12 -2
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/test_goethereum_ipc.py +12 -2
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/test_goethereum_legacy_ws.py +2 -2
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/test_goethereum_ws/conftest.py +2 -2
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/eth_module.py +14 -40
- {web3-7.12.0 → web3-7.13.0}/web3/eth/async_eth.py +2 -13
- {web3-7.12.0 → web3-7.13.0}/web3/exceptions.py +8 -1
- {web3-7.12.0 → web3-7.13.0}/web3/manager.py +5 -8
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/formatting.py +7 -1
- {web3-7.12.0 → web3-7.13.0}/web3/providers/auto.py +28 -6
- {web3-7.12.0 → web3-7.13.0}/web3/providers/ipc.py +2 -2
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/persistent.py +4 -3
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/subscription_manager.py +66 -13
- {web3-7.12.0 → web3-7.13.0}/web3/utils/subscriptions.py +23 -2
- {web3-7.12.0 → web3-7.13.0/web3.egg-info}/PKG-INFO +1 -1
- {web3-7.12.0 → web3-7.13.0}/web3.egg-info/SOURCES.txt +1 -1
- web3-7.12.0/tests/core/middleware/test_formatting_middleware.py +0 -103
- web3-7.12.0/tests/core/subscriptions/test_subscription_manager.py +0 -215
- web3-7.12.0/tests/integration/geth-1.15.11-fixture.zip +0 -0
- {web3-7.12.0 → web3-7.13.0}/LICENSE +0 -0
- {web3-7.12.0 → web3-7.13.0}/MANIFEST.in +0 -0
- {web3-7.12.0 → web3-7.13.0}/README.md +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/_normalization.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/abis.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/async_ens.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/auto.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/base_ens.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/constants.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/contract_data.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/ens.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/exceptions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/specs/nf.json +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/specs/normalization_spec.json +0 -0
- {web3-7.12.0 → web3-7.13.0}/ens/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/scripts/release/test_package.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/setup.cfg +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/beacon/test_async_beacon.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/beacon/test_beacon.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/admin-module/test_admin_addPeer.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/admin-module/test_admin_nodeInfo.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/admin-module/test_admin_peers.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/block-utils/test_select_method_for_block_identifier.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/caching-utils/test_generate_cache_key.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/caching-utils/test_request_caching.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_ambiguous_events.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_ambiguous_functions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_attributes.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_build_transaction.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_call_interface.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_caller_interface.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_class_construction.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_constructor.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_constructor_encoding.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_deployment.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_estimate_gas.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_events.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_events_build_filter.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_example.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_init.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_method_abi_decoding.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_method_abi_encoding.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_method_to_argument_matching.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_panic_errors.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_transact_interface.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_contract_util_functions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_extracting_event_data.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_extracting_event_data_old.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/test_offchain_lookup.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/contracts/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/datastructures/test_datastructures.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/empty-object/test_empty_object_is_falsy.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_block_api.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_default_account_api.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_eth_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_eth_fee_history.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_eth_filter.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_eth_properties.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_gas_pricing.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_poa.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-module/test_transactions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/eth-tester-api/test_withdrawals.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/exceptions/test_exceptions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_basic_filter_tests.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_contract_create_filter_topic_merging.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_contract_data_filters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_contract_get_logs.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_contract_on_event_filtering.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_contract_past_event_filtering.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_contract_topic_filters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_existing_filter_instance.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_filter_against_latest_blocks.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_filter_against_pending_transactions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_filter_against_transaction_logs.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_filters_against_many_blocks.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/test_utils_functions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/filtering/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/gas-strategies/test_rpc_gas_pricing_strategies.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/gas-strategies/test_time_based_gas_price_strategy.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/manager/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/manager/test_default_middlewares.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/manager/test_middleware_can_be_stateful.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/manager/test_middleware_onion_api.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/manager/test_provider_property.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/manager/test_provider_request_wrapping.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/manager/test_response_formatters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/method-class/test_method.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/method-class/test_result_formatters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/middleware/test_attrdict_middleware.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/middleware/test_eth_tester_middleware.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/middleware/test_filter_middleware.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/middleware/test_gas_price_strategy.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/middleware/test_middleware.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/middleware/test_name_to_address_middleware.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/middleware/test_stalecheck.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/middleware/test_transaction_signing.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/module-class/test_module.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_async_http_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_async_ipc_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_async_tester_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_auto_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_base_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_http_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_http_request_retry.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_ipc_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_legacy_websocket_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_provider_init.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_tester_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/providers/test_websocket_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/subscriptions/test_subscriptions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/test_library_files.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/testing-module/test_testing_mine.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/testing-module/test_testing_snapshot_and_revert.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/testing-module/test_testing_timeTravel.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_abi.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_abi_filtering_by_argument_name.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_abi_is_encodable.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_abi_named_tree.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_address.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_async_transaction.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_attach_modules.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_attributedict.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_caching_utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_construct_event_data_set.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_construct_event_filter_params.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_construct_event_topics.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_datatypes.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_decorators.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_encoding.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_event_filter_builder.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_event_interface.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_fee_utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_formatters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_http_session_manager.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_is_predefined_block_number.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_is_probably_enum.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_is_recognized_type.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_math.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_method_formatters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_prepare_transaction_replacement.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_select_filter_method.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_threads.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_valid_transaction_params.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/utilities/test_validation.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_api.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_attach_modules.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_client_version.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_conversions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_import_and_version.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_keccak.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_providers.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_strict_bytes_type_checking.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/core/web3-module/test_web3_inheritance.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/normalization/normalization_tests.json +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/normalization/test_normalize_name_ensip15.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_ens.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_get_registry.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_get_text.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_nameprep.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_offchain_resolution.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_setup_address.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_setup_name.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/ens/test_wildcard_resolution.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/README.md +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/common.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/conftest.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/generate_fixtures/common.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/generate_fixtures/go_ethereum.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/common.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/test_goethereum_ws/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_await_w3.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_ctx_manager_w3.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/test_goethereum_ws/test_async_iterator_w3.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/go_ethereum/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/integration/test_ethereum_tester.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/tests/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/abi.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/abi_element_identifiers.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/async_caching.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/async_transactions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/batching.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/blocks.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/caching/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/caching/caching_utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/caching/request_caching_validation.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/compat/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/compile_contracts.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/_custom_contract_data.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/ambiguous_function_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/arrays_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/bytes_contracts.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/constructor_contracts.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/contract_caller_tester.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/emitter_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/event_contracts.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/extended_resolver.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/fallback_function_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/math_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/offchain_lookup.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/offchain_resolver.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/panic_errors_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/payable_tester.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/receive_function_contracts.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/reflector_contracts.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/revert_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/simple_resolver.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/storage_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/string_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contract_sources/contract_data/tuple_contracts.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/contracts.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/datatypes.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/decorators.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/empty.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/encoding.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/ens.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/error_formatters_utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/events.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/fee_utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/filters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/formatters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/http.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/http_session_manager.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/hypothesis.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/math.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/method_formatters.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/go_ethereum_admin_module.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/go_ethereum_debug_module.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/go_ethereum_txpool_module.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/module_testing_utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/net_module.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/persistent_connection_provider.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/module_testing/web3_module.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/normalizers.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/rpc_abi.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/threads.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/transactions.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/type_conversion.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/utility_methods.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/validation.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/_utils/windows.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/auto/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/auto/gethdev.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/beacon/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/beacon/api_endpoints.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/beacon/async_beacon.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/beacon/beacon.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/constants.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/contract/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/contract/async_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/contract/base_contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/contract/contract.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/contract/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/datastructures.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/eth/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/eth/base_eth.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/eth/eth.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/gas_strategies/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/gas_strategies/rpc.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/gas_strategies/time_based.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/geth.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/logs.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/main.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/method.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/attrdict.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/base.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/buffered_gas_estimate.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/filter.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/gas_price_strategy.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/names.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/proof_of_authority.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/pythonic.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/signing.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/stalecheck.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/middleware/validation.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/module.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/net.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/async_base.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/base.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/eth_tester/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/eth_tester/defaults.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/eth_tester/main.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/eth_tester/middleware.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/legacy_websocket.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/async_ipc.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/persistent_connection.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/request_processor.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/subscription_container.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/persistent/websocket.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/rpc/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/rpc/async_rpc.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/rpc/rpc.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/providers/rpc/utils.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/py.typed +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/scripts/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/scripts/install_pre_releases.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/scripts/parse_pygeth_version.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/scripts/release/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/scripts/release/test_package.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/testing.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/tracing.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/types.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/utils/__init__.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/utils/abi.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/utils/address.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/utils/async_exception_handling.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/utils/caching.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3/utils/exception_handling.py +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3.egg-info/dependency_links.txt +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3.egg-info/not-zip-safe +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3.egg-info/requires.txt +0 -0
- {web3-7.12.0 → web3-7.13.0}/web3.egg-info/top_level.txt +0 -0
|
@@ -55,7 +55,7 @@ with open("./README.md") as readme:
|
|
|
55
55
|
setup(
|
|
56
56
|
name="web3",
|
|
57
57
|
# *IMPORTANT*: Don't manually change the version here. See Contributing docs for the release process.
|
|
58
|
-
version="7.
|
|
58
|
+
version="7.13.0",
|
|
59
59
|
description="""web3: A Python library for interacting with Ethereum""",
|
|
60
60
|
long_description=long_description,
|
|
61
61
|
long_description_content_type="text/markdown",
|
|
@@ -264,6 +264,7 @@ def test_eth_account_sign(
|
|
|
264
264
|
acct, message_text, key, expected_bytes, expected_hash, v, r, s, signature
|
|
265
265
|
):
|
|
266
266
|
message = encode_defunct(text=message_text)
|
|
267
|
+
assert message.body == expected_bytes
|
|
267
268
|
signed_message = Web3.keccak(
|
|
268
269
|
b"\x19Ethereum Signed Message:\n"
|
|
269
270
|
+ bytes(f"{len(message.body)}", encoding="utf-8")
|
|
@@ -357,9 +358,9 @@ def test_eth_account_sign(
|
|
|
357
358
|
),
|
|
358
359
|
(
|
|
359
360
|
{
|
|
360
|
-
"gas":
|
|
361
|
-
"maxFeePerGas":
|
|
362
|
-
"maxPriorityFeePerGas":
|
|
361
|
+
"gas": "0x186a0",
|
|
362
|
+
"maxFeePerGas": "0x77359400",
|
|
363
|
+
"maxPriorityFeePerGas": "0x77359400",
|
|
363
364
|
"data": "0x5544",
|
|
364
365
|
"nonce": "0x2",
|
|
365
366
|
"to": "0x96216849c49358B10257cb55b28eA603c874b05E",
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from unittest.mock import (
|
|
3
|
+
Mock,
|
|
4
|
+
)
|
|
5
|
+
|
|
6
|
+
import pytest_asyncio
|
|
7
|
+
|
|
8
|
+
from web3 import (
|
|
9
|
+
AsyncBaseProvider,
|
|
10
|
+
AsyncWeb3,
|
|
11
|
+
Web3,
|
|
12
|
+
)
|
|
13
|
+
from web3.exceptions import (
|
|
14
|
+
BadResponseFormat,
|
|
15
|
+
Web3RPCError,
|
|
16
|
+
)
|
|
17
|
+
from web3.middleware import (
|
|
18
|
+
FormattingMiddlewareBuilder,
|
|
19
|
+
)
|
|
20
|
+
from web3.providers.base import (
|
|
21
|
+
BaseProvider,
|
|
22
|
+
)
|
|
23
|
+
from web3.types import (
|
|
24
|
+
RPCEndpoint,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class DummyProvider(BaseProvider):
|
|
29
|
+
def make_request(self, method, params):
|
|
30
|
+
raise NotImplementedError(f"Cannot make request for {method}:{params}")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@pytest.fixture
|
|
34
|
+
def w3():
|
|
35
|
+
return Web3(provider=DummyProvider(), middleware=[])
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_formatting_middleware(w3, request_mocker):
|
|
39
|
+
# No formatters by default
|
|
40
|
+
expected = "done"
|
|
41
|
+
with request_mocker(w3, mock_results={"test_endpoint": "done"}):
|
|
42
|
+
actual = w3.manager.request_blocking(RPCEndpoint("test_endpoint"), [])
|
|
43
|
+
assert actual == expected
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_formatting_middleware_no_method(w3):
|
|
47
|
+
w3.middleware_onion.add(FormattingMiddlewareBuilder.build())
|
|
48
|
+
|
|
49
|
+
# Formatting middleware requires an endpoint
|
|
50
|
+
with pytest.raises(NotImplementedError):
|
|
51
|
+
w3.manager.request_blocking("test_endpoint", [])
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def test_formatting_middleware_request_formatters(w3, request_mocker):
|
|
55
|
+
callable_mock = Mock()
|
|
56
|
+
w3.middleware_onion.add(
|
|
57
|
+
FormattingMiddlewareBuilder.build(
|
|
58
|
+
request_formatters={"test_endpoint": callable_mock}
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
expected = "done"
|
|
63
|
+
with request_mocker(w3, mock_results={"test_endpoint": "done"}):
|
|
64
|
+
actual = w3.manager.request_blocking("test_endpoint", ["param1"])
|
|
65
|
+
|
|
66
|
+
callable_mock.assert_called_once_with(["param1"])
|
|
67
|
+
assert actual == expected
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_formatting_middleware_result_formatters(w3, request_mocker):
|
|
71
|
+
w3.middleware_onion.add(
|
|
72
|
+
FormattingMiddlewareBuilder.build(
|
|
73
|
+
result_formatters={"test_endpoint": lambda x: f"STATUS: {x}"}
|
|
74
|
+
)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
expected = "STATUS: done"
|
|
78
|
+
with request_mocker(w3, mock_results={"test_endpoint": "done"}):
|
|
79
|
+
actual = w3.manager.request_blocking("test_endpoint", [])
|
|
80
|
+
|
|
81
|
+
assert actual == expected
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_formatting_middleware_result_formatters_for_none(w3, request_mocker):
|
|
85
|
+
w3.middleware_onion.add(
|
|
86
|
+
FormattingMiddlewareBuilder.build(
|
|
87
|
+
result_formatters={"test_endpoint": lambda x: hex(x)}
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
expected = None
|
|
92
|
+
with request_mocker(w3, mock_results={"test_endpoint": expected}):
|
|
93
|
+
actual = w3.manager.request_blocking("test_endpoint", [])
|
|
94
|
+
assert actual == expected
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def test_formatting_middleware_error_formatters(w3, request_mocker):
|
|
98
|
+
w3.middleware_onion.add(
|
|
99
|
+
FormattingMiddlewareBuilder.build(
|
|
100
|
+
result_formatters={"test_endpoint": lambda x: f"STATUS: {x}"}
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
expected = "error"
|
|
105
|
+
with request_mocker(w3, mock_errors={"test_endpoint": {"message": "error"}}):
|
|
106
|
+
with pytest.raises(Web3RPCError) as err:
|
|
107
|
+
w3.manager.request_blocking("test_endpoint", [])
|
|
108
|
+
assert str(err.value) == expected
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def test_formatting_middleware_raises_for_non_dict_responses(w3, request_mocker):
|
|
112
|
+
w3.middleware_onion.add(
|
|
113
|
+
FormattingMiddlewareBuilder.build(
|
|
114
|
+
result_formatters={"test_endpoint": lambda x: x}
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
w3.provider.make_request = lambda *_: "a string"
|
|
118
|
+
|
|
119
|
+
with pytest.raises(
|
|
120
|
+
BadResponseFormat,
|
|
121
|
+
match=r"Malformed response: expected a valid JSON-RPC response object, "
|
|
122
|
+
r"got: `a string`",
|
|
123
|
+
):
|
|
124
|
+
_ = w3.eth.chain_id
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# -- async -- #
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@pytest_asyncio.fixture
|
|
131
|
+
async def async_w3():
|
|
132
|
+
return AsyncWeb3(provider=AsyncBaseProvider(), middleware=[])
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@pytest.mark.asyncio
|
|
136
|
+
async def test_async_formatting_middleware(async_w3, request_mocker):
|
|
137
|
+
# No formatters by default
|
|
138
|
+
expected = "done"
|
|
139
|
+
async with request_mocker(async_w3, mock_results={"test_endpoint": "done"}):
|
|
140
|
+
actual = await async_w3.manager.coro_request(RPCEndpoint("test_endpoint"), [])
|
|
141
|
+
assert actual == expected
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
@pytest.mark.asyncio
|
|
145
|
+
async def test_async_formatting_middleware_no_method(async_w3):
|
|
146
|
+
async_w3.middleware_onion.add(FormattingMiddlewareBuilder.build())
|
|
147
|
+
|
|
148
|
+
# Formatting middleware requires an endpoint
|
|
149
|
+
with pytest.raises(NotImplementedError):
|
|
150
|
+
await async_w3.manager.coro_request("test_endpoint", [])
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@pytest.mark.asyncio
|
|
154
|
+
async def test_async_formatting_middleware_request_formatters(async_w3, request_mocker):
|
|
155
|
+
callable_mock = Mock()
|
|
156
|
+
async_w3.middleware_onion.add(
|
|
157
|
+
FormattingMiddlewareBuilder.build(
|
|
158
|
+
request_formatters={"test_endpoint": callable_mock}
|
|
159
|
+
)
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
expected = "done"
|
|
163
|
+
async with request_mocker(async_w3, mock_results={"test_endpoint": "done"}):
|
|
164
|
+
actual = await async_w3.manager.coro_request("test_endpoint", ["param1"])
|
|
165
|
+
|
|
166
|
+
callable_mock.assert_called_once_with(["param1"])
|
|
167
|
+
assert actual == expected
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
@pytest.mark.asyncio
|
|
171
|
+
async def test_async_formatting_middleware_result_formatters(async_w3, request_mocker):
|
|
172
|
+
async_w3.middleware_onion.add(
|
|
173
|
+
FormattingMiddlewareBuilder.build(
|
|
174
|
+
result_formatters={"test_endpoint": lambda x: f"STATUS: {x}"}
|
|
175
|
+
)
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
expected = "STATUS: done"
|
|
179
|
+
async with request_mocker(async_w3, mock_results={"test_endpoint": "done"}):
|
|
180
|
+
actual = await async_w3.manager.coro_request("test_endpoint", [])
|
|
181
|
+
|
|
182
|
+
assert actual == expected
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
@pytest.mark.asyncio
|
|
186
|
+
async def test_async_formatting_middleware_result_formatters_for_none(
|
|
187
|
+
async_w3, request_mocker
|
|
188
|
+
):
|
|
189
|
+
async_w3.middleware_onion.add(
|
|
190
|
+
FormattingMiddlewareBuilder.build(
|
|
191
|
+
result_formatters={"test_endpoint": lambda x: hex(x)}
|
|
192
|
+
)
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
expected = None
|
|
196
|
+
async with request_mocker(async_w3, mock_results={"test_endpoint": expected}):
|
|
197
|
+
actual = await async_w3.manager.coro_request("test_endpoint", [])
|
|
198
|
+
assert actual == expected
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
@pytest.mark.asyncio
|
|
202
|
+
async def test_async_formatting_middleware_error_formatters(async_w3, request_mocker):
|
|
203
|
+
async_w3.middleware_onion.add(
|
|
204
|
+
FormattingMiddlewareBuilder.build(
|
|
205
|
+
result_formatters={"test_endpoint": lambda x: f"STATUS: {x}"}
|
|
206
|
+
)
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
expected = "error"
|
|
210
|
+
async with request_mocker(
|
|
211
|
+
async_w3, mock_errors={"test_endpoint": {"message": "error"}}
|
|
212
|
+
):
|
|
213
|
+
with pytest.raises(Web3RPCError) as err:
|
|
214
|
+
await async_w3.manager.coro_request("test_endpoint", [])
|
|
215
|
+
assert str(err.value) == expected
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@pytest.mark.asyncio
|
|
219
|
+
async def test_async_formatting_middleware_raises_for_non_dict_responses(async_w3):
|
|
220
|
+
async_w3.middleware_onion.add(
|
|
221
|
+
FormattingMiddlewareBuilder.build(
|
|
222
|
+
result_formatters={"test_endpoint": lambda x: x}
|
|
223
|
+
)
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
async def _make_request(*_):
|
|
227
|
+
return "a string"
|
|
228
|
+
|
|
229
|
+
async_w3.provider.make_request = _make_request
|
|
230
|
+
|
|
231
|
+
with pytest.raises(
|
|
232
|
+
BadResponseFormat,
|
|
233
|
+
match=r"Malformed response: expected a valid JSON-RPC response object, "
|
|
234
|
+
r"got: `a string`",
|
|
235
|
+
):
|
|
236
|
+
_ = await async_w3.eth.chain_id
|