From e96fece2b6abecc636a1e1ac8a405ab4030942ef Mon Sep 17 00:00:00 2001 From: Tiffany McKenzie <25855566+tmckenzie51@users.noreply.github.com> Date: Thu, 11 Mar 2021 14:27:30 -0500 Subject: [PATCH] update docs and test --- docs/overview.rst | 2 +- docs/web3.eth.rst | 9 +++++++-- tests/core/middleware/test_gas_price_strategy.py | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/overview.rst b/docs/overview.rst index dbebef1287..4a264af004 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -180,7 +180,7 @@ API - :meth:`web3.eth.sign() ` - :meth:`web3.eth.signTypedData() ` - :meth:`web3.eth.estimateGas() ` -- :meth:`web3.eth.generateGasPrice() ` +- :meth:`web3.eth.generate_gas_price() ` - :meth:`web3.eth.setGasPriceStrategy() ` diff --git a/docs/web3.eth.rst b/docs/web3.eth.rst index da8fad067d..704a380ffd 100644 --- a/docs/web3.eth.rst +++ b/docs/web3.eth.rst @@ -960,7 +960,7 @@ The following methods are available on the ``web3.eth`` namespace. nodes would result in an error like: ``ValueError: {'code': -32602, 'message': 'too many arguments, want at most 1'}`` -.. py:method:: Eth.generateGasPrice(transaction_params=None) +.. py:method:: Eth.generate_gas_price(transaction_params=None) Uses the selected gas price strategy to calculate a gas price. This method returns the gas price denominated in wei. @@ -970,13 +970,18 @@ The following methods are available on the ``web3.eth`` namespace. .. code-block:: python - >>> Web3.eth.generateGasPrice() + >>> Web3.eth.generate_gas_price() 20000000000 .. note:: For information about how gas price can be customized in web3 see :ref:`Gas_Price`. +.. py:method:: Eth.generateGasPrice(transaction_params=None) + + .. warning:: Deprecated: This method is deprecated in favor of + :meth:`~web3.eth.Eth.generate_gas_price_strategy()` + .. py:method:: Eth.setGasPriceStrategy(gas_price_strategy) Set the selected gas price strategy. It must be a method of the signature diff --git a/tests/core/middleware/test_gas_price_strategy.py b/tests/core/middleware/test_gas_price_strategy.py index 106e5363c5..14bb9bd8c4 100644 --- a/tests/core/middleware/test_gas_price_strategy.py +++ b/tests/core/middleware/test_gas_price_strategy.py @@ -18,14 +18,14 @@ def the_gas_price_strategy_middleware(web3): def test_gas_price_generated(the_gas_price_strategy_middleware): - the_gas_price_strategy_middleware.web3.eth.generateGasPrice.return_value = 5 + the_gas_price_strategy_middleware.web3.eth.generate_gas_price.return_value = 5 method = 'eth_sendTransaction' params = [{ 'to': '0x0', 'value': 1, }] the_gas_price_strategy_middleware(method, params) - the_gas_price_strategy_middleware.web3.eth.generateGasPrice.assert_called_once_with({ + the_gas_price_strategy_middleware.web3.eth.generate_gas_price.assert_called_once_with({ 'to': '0x0', 'value': 1, }) @@ -37,7 +37,7 @@ def test_gas_price_generated(the_gas_price_strategy_middleware): def test_gas_price_not_overridden(the_gas_price_strategy_middleware): - the_gas_price_strategy_middleware.web3.eth.generateGasPrice.return_value = 5 + the_gas_price_strategy_middleware.web3.eth.generate_gas_price.return_value = 5 method = 'eth_sendTransaction' params = [{ 'to': '0x0', @@ -53,7 +53,7 @@ def test_gas_price_not_overridden(the_gas_price_strategy_middleware): def test_gas_price_not_set_without_gas_price_strategy(the_gas_price_strategy_middleware): - the_gas_price_strategy_middleware.web3.eth.generateGasPrice.return_value = None + the_gas_price_strategy_middleware.web3.eth.generate_gas_price.return_value = None method = 'eth_sendTransaction' params = [{ 'to': '0x0',