From 1e287de589031639ce7f9c1050a0d0f5f70faa28 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 5 Jul 2024 08:54:49 +0200 Subject: [PATCH] chore: fix mote A violations in tests and scripts --- ft_client/test_client/test_rest_client.py | 4 ++-- scripts/ws_client.py | 8 ++++---- tests/data/test_datahandler.py | 6 +++--- tests/exchange/test_binance.py | 6 +++--- tests/leverage/test_candletype.py | 12 ++++++------ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/ft_client/test_client/test_rest_client.py b/ft_client/test_client/test_rest_client.py index 541577e59..1a709b9c5 100644 --- a/ft_client/test_client/test_rest_client.py +++ b/ft_client/test_client/test_rest_client.py @@ -133,8 +133,8 @@ def test_FtRestClient_call_invalid(caplog): ) def test_FtRestClient_call_explicit_methods(method, args, kwargs): client, mock = get_rest_client() - exec = getattr(client, method) - exec(*args, **kwargs) + executor = getattr(client, method) + executor(*args, **kwargs) assert mock.call_count == 1 diff --git a/scripts/ws_client.py b/scripts/ws_client.py index ec6df5742..81e539e26 100755 --- a/scripts/ws_client.py +++ b/scripts/ws_client.py @@ -172,10 +172,10 @@ class ClientProtocol: return readable_timedelta(time_delta) - async def _handle_whitelist(self, name, type, data): + async def _handle_whitelist(self, name, msgtype, data): self.logger.info(data) - async def _handle_analyzed_df(self, name, type, data): + async def _handle_analyzed_df(self, name, msgtype, data): key, la, df = data["key"], data["la"], data["df"] if not df.empty: @@ -189,8 +189,8 @@ class ClientProtocol: else: self.logger.info("Empty DataFrame") - async def _handle_default(self, name, type, data): - self.logger.info("Unknown message of type {type} received...") + async def _handle_default(self, name, msgtype, data): + self.logger.info("Unknown message of type {msgtype} received...") self.logger.info(data) diff --git a/tests/data/test_datahandler.py b/tests/data/test_datahandler.py index 1f66d1b1e..b8bb5661f 100644 --- a/tests/data/test_datahandler.py +++ b/tests/data/test_datahandler.py @@ -83,7 +83,7 @@ def test_datahandler_ohlcv_regex(filename, pair, timeframe, candletype): @pytest.mark.parametrize( - "input,expected", + "pair,expected", [ ("XMR_USDT", "XMR/USDT"), ("BTC_USDT", "BTC/USDT"), @@ -95,8 +95,8 @@ def test_datahandler_ohlcv_regex(filename, pair, timeframe, candletype): ("UNITTEST_USDT", "UNITTEST/USDT"), ], ) -def test_rebuild_pair_from_filename(input, expected): - assert IDataHandler.rebuild_pair_from_filename(input) == expected +def test_rebuild_pair_from_filename(pair, expected): + assert IDataHandler.rebuild_pair_from_filename(pair) == expected def test_datahandler_ohlcv_get_available_data(testdatadir): diff --git a/tests/exchange/test_binance.py b/tests/exchange/test_binance.py index b961c2809..8f9b801f3 100644 --- a/tests/exchange/test_binance.py +++ b/tests/exchange/test_binance.py @@ -12,7 +12,7 @@ from tests.exchange.test_exchange import ccxt_exceptionhandlers @pytest.mark.parametrize( - "side,type,time_in_force,expected", + "side,order_type,time_in_force,expected", [ ("buy", "limit", "gtc", {"timeInForce": "GTC"}), ("buy", "limit", "IOC", {"timeInForce": "IOC"}), @@ -22,9 +22,9 @@ from tests.exchange.test_exchange import ccxt_exceptionhandlers ("sell", "market", "PO", {}), ], ) -def test__get_params_binance(default_conf, mocker, side, type, time_in_force, expected): +def test__get_params_binance(default_conf, mocker, side, order_type, time_in_force, expected): exchange = get_patched_exchange(mocker, default_conf, id="binance") - assert exchange._get_params(side, type, 1, False, time_in_force) == expected + assert exchange._get_params(side, order_type, 1, False, time_in_force) == expected @pytest.mark.parametrize("trademode", [TradingMode.FUTURES, TradingMode.SPOT]) diff --git a/tests/leverage/test_candletype.py b/tests/leverage/test_candletype.py index a424012d7..8a2c4ba3e 100644 --- a/tests/leverage/test_candletype.py +++ b/tests/leverage/test_candletype.py @@ -4,7 +4,7 @@ from freqtrade.enums import CandleType @pytest.mark.parametrize( - "input,expected", + "candle_type,expected", [ ("", CandleType.SPOT), ("spot", CandleType.SPOT), @@ -17,17 +17,17 @@ from freqtrade.enums import CandleType ("premiumIndex", CandleType.PREMIUMINDEX), ], ) -def test_CandleType_from_string(input, expected): - assert CandleType.from_string(input) == expected +def test_CandleType_from_string(candle_type, expected): + assert CandleType.from_string(candle_type) == expected @pytest.mark.parametrize( - "input,expected", + "candle_type,expected", [ ("futures", CandleType.FUTURES), ("spot", CandleType.SPOT), ("margin", CandleType.SPOT), ], ) -def test_CandleType_get_default(input, expected): - assert CandleType.get_default(input) == expected +def test_CandleType_get_default(candle_type, expected): + assert CandleType.get_default(candle_type) == expected