From 9df366d9431b902a4061fa09dd9a230f0e28d196 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 28 Sep 2020 19:43:15 +0200 Subject: [PATCH] Apply isort to tests --- tests/commands/test_build_config.py | 6 ++---- tests/commands/test_commands.py | 17 +++++++---------- tests/conftest.py | 5 +++-- tests/data/test_btanalysis.py | 15 +++++---------- tests/data/test_converter.py | 12 +++++------- tests/data/test_history.py | 21 ++++++++++----------- tests/edge/test_edge.py | 3 ++- tests/exchange/test_binance.py | 3 +-- tests/exchange/test_exchange.py | 15 ++++++--------- tests/exchange/test_ftx.py | 1 + tests/exchange/test_kraken.py | 1 + tests/optimize/__init__.py | 1 + tests/optimize/test_backtest_detail.py | 1 + tests/optimize/test_backtesting.py | 4 ++-- tests/optimize/test_hyperopt.py | 8 +++----- tests/optimize/test_optimize_reports.py | 16 ++++++---------- tests/rpc/test_rpc.py | 3 +-- tests/rpc/test_rpc_apiserver.py | 4 ++-- tests/rpc/test_rpc_manager.py | 6 +++--- tests/rpc/test_rpc_telegram.py | 5 ++--- tests/strategy/strats/legacy_strategy.py | 9 +++++---- tests/strategy/test_interface.py | 1 + tests/strategy/test_strategy_helpers.py | 2 +- tests/test_configuration.py | 12 +++++------- tests/test_directory_operations.py | 3 +-- tests/test_freqtradebot.py | 23 +++++++++-------------- tests/test_indicators.py | 3 ++- tests/test_main.py | 2 +- tests/test_misc.py | 5 ++--- tests/test_plotting.py | 11 ++++------- tests/test_talib.py | 2 +- 31 files changed, 96 insertions(+), 124 deletions(-) diff --git a/tests/commands/test_build_config.py b/tests/commands/test_build_config.py index 69b277e3b..291720f4b 100644 --- a/tests/commands/test_build_config.py +++ b/tests/commands/test_build_config.py @@ -4,10 +4,8 @@ from unittest.mock import MagicMock import pytest import rapidjson -from freqtrade.commands.build_config_commands import (ask_user_config, - ask_user_overwrite, - start_new_config, - validate_is_float, +from freqtrade.commands.build_config_commands import (ask_user_config, ask_user_overwrite, + start_new_config, validate_is_float, validate_is_int) from freqtrade.exceptions import OperationalException from tests.conftest import get_args, log_has_re diff --git a/tests/commands/test_commands.py b/tests/commands/test_commands.py index 192e125f8..5b125697c 100644 --- a/tests/commands/test_commands.py +++ b/tests/commands/test_commands.py @@ -5,19 +5,16 @@ from unittest.mock import MagicMock, PropertyMock import arrow import pytest -from freqtrade.commands import (start_convert_data, start_create_userdir, - start_download_data, start_hyperopt_list, - start_hyperopt_show, start_list_data, - start_list_exchanges, start_list_hyperopts, - start_list_markets, start_list_strategies, - start_list_timeframes, start_new_hyperopt, - start_new_strategy, start_show_trades, - start_test_pairlist, start_trading) +from freqtrade.commands import (start_convert_data, start_create_userdir, start_download_data, + start_hyperopt_list, start_hyperopt_show, start_list_data, + start_list_exchanges, start_list_hyperopts, start_list_markets, + start_list_strategies, start_list_timeframes, start_new_hyperopt, + start_new_strategy, start_show_trades, start_test_pairlist, + start_trading) from freqtrade.configuration import setup_utils_configuration from freqtrade.exceptions import OperationalException from freqtrade.state import RunMode -from tests.conftest import (create_mock_trades, get_args, log_has, log_has_re, - patch_exchange, +from tests.conftest import (create_mock_trades, get_args, log_has, log_has_re, patch_exchange, patched_configuration_load_config_file) from tests.conftest_trades import MOCK_TRADE_COUNT diff --git a/tests/conftest.py b/tests/conftest.py index fe55c8784..dbd0df8f6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,8 +22,9 @@ from freqtrade.freqtradebot import FreqtradeBot from freqtrade.persistence import Trade from freqtrade.resolvers import ExchangeResolver from freqtrade.worker import Worker -from tests.conftest_trades import (mock_trade_1, mock_trade_2, mock_trade_3, - mock_trade_4, mock_trade_5, mock_trade_6) +from tests.conftest_trades import (mock_trade_1, mock_trade_2, mock_trade_3, mock_trade_4, + mock_trade_5, mock_trade_6) + logging.getLogger('').setLevel(logging.INFO) diff --git a/tests/data/test_btanalysis.py b/tests/data/test_btanalysis.py index 564dae0b1..a6270e92d 100644 --- a/tests/data/test_btanalysis.py +++ b/tests/data/test_btanalysis.py @@ -7,16 +7,11 @@ from pandas import DataFrame, DateOffset, Timestamp, to_datetime from freqtrade.configuration import TimeRange from freqtrade.constants import LAST_BT_RESULT_FN -from freqtrade.data.btanalysis import (BT_DATA_COLUMNS, - analyze_trade_parallelism, - calculate_market_change, - calculate_max_drawdown, - combine_dataframes_with_mean, - create_cum_profit, - extract_trades_of_period, - get_latest_backtest_filename, - load_backtest_data, load_trades, - load_trades_from_db) +from freqtrade.data.btanalysis import (BT_DATA_COLUMNS, analyze_trade_parallelism, + calculate_market_change, calculate_max_drawdown, + combine_dataframes_with_mean, create_cum_profit, + extract_trades_of_period, get_latest_backtest_filename, + load_backtest_data, load_trades, load_trades_from_db) from freqtrade.data.history import load_data, load_pair_history from freqtrade.optimize.backtesting import BacktestResult from tests.conftest import create_mock_trades diff --git a/tests/data/test_converter.py b/tests/data/test_converter.py index 4a580366f..fdba7900f 100644 --- a/tests/data/test_converter.py +++ b/tests/data/test_converter.py @@ -2,13 +2,11 @@ import logging from freqtrade.configuration.timerange import TimeRange -from freqtrade.data.converter import (convert_ohlcv_format, - convert_trades_format, - ohlcv_fill_up_missing_data, - ohlcv_to_dataframe, trades_dict_to_list, - trades_remove_duplicates, trim_dataframe) -from freqtrade.data.history import (get_timerange, load_data, - load_pair_history, validate_backtest_data) +from freqtrade.data.converter import (convert_ohlcv_format, convert_trades_format, + ohlcv_fill_up_missing_data, ohlcv_to_dataframe, + trades_dict_to_list, trades_remove_duplicates, trim_dataframe) +from freqtrade.data.history import (get_timerange, load_data, load_pair_history, + validate_backtest_data) from tests.conftest import log_has from tests.data.test_history import _backup_file, _clean_test_file diff --git a/tests/data/test_history.py b/tests/data/test_history.py index 787f62a75..c8324cf0b 100644 --- a/tests/data/test_history.py +++ b/tests/data/test_history.py @@ -15,20 +15,19 @@ from freqtrade.configuration import TimeRange from freqtrade.constants import AVAILABLE_DATAHANDLERS from freqtrade.data.converter import ohlcv_to_dataframe from freqtrade.data.history.hdf5datahandler import HDF5DataHandler -from freqtrade.data.history.history_utils import ( - _download_pair_history, _download_trades_history, - _load_cached_data_for_updating, convert_trades_to_ohlcv, get_timerange, - load_data, load_pair_history, refresh_backtest_ohlcv_data, - refresh_backtest_trades_data, refresh_data, validate_backtest_data) -from freqtrade.data.history.idatahandler import (IDataHandler, get_datahandler, - get_datahandlerclass) -from freqtrade.data.history.jsondatahandler import (JsonDataHandler, - JsonGzDataHandler) +from freqtrade.data.history.history_utils import (_download_pair_history, _download_trades_history, + _load_cached_data_for_updating, + convert_trades_to_ohlcv, get_timerange, load_data, + load_pair_history, refresh_backtest_ohlcv_data, + refresh_backtest_trades_data, refresh_data, + validate_backtest_data) +from freqtrade.data.history.idatahandler import IDataHandler, get_datahandler, get_datahandlerclass +from freqtrade.data.history.jsondatahandler import JsonDataHandler, JsonGzDataHandler from freqtrade.exchange import timeframe_to_minutes from freqtrade.misc import file_dump_json from freqtrade.resolvers import StrategyResolver -from tests.conftest import (get_patched_exchange, log_has, log_has_re, - patch_exchange) +from tests.conftest import get_patched_exchange, log_has, log_has_re, patch_exchange + # Change this if modifying UNITTEST/BTC testdatafile _BTC_UNITTEST_LENGTH = 13681 diff --git a/tests/edge/test_edge.py b/tests/edge/test_edge.py index d35f7fcf6..f19590490 100644 --- a/tests/edge/test_edge.py +++ b/tests/edge/test_edge.py @@ -10,14 +10,15 @@ import numpy as np import pytest from pandas import DataFrame, to_datetime -from freqtrade.exceptions import OperationalException from freqtrade.data.converter import ohlcv_to_dataframe from freqtrade.edge import Edge, PairInfo +from freqtrade.exceptions import OperationalException from freqtrade.strategy.interface import SellType from tests.conftest import get_patched_freqtradebot, log_has from tests.optimize import (BTContainer, BTrade, _build_backtest_dataframe, _get_frame_time_from_offset) + # Cases to be tested: # 1) Open trade should be removed from the end # 2) Two complete trades within dataframe (with sell hit for all) diff --git a/tests/exchange/test_binance.py b/tests/exchange/test_binance.py index 72da708b4..f2b508761 100644 --- a/tests/exchange/test_binance.py +++ b/tests/exchange/test_binance.py @@ -4,8 +4,7 @@ from unittest.mock import MagicMock import ccxt import pytest -from freqtrade.exceptions import (DependencyException, InvalidOrderException, - OperationalException) +from freqtrade.exceptions import DependencyException, InvalidOrderException, OperationalException from tests.conftest import get_patched_exchange from tests.exchange.test_exchange import ccxt_exceptionhandlers diff --git a/tests/exchange/test_exchange.py b/tests/exchange/test_exchange.py index e0b97d157..7be9c77ac 100644 --- a/tests/exchange/test_exchange.py +++ b/tests/exchange/test_exchange.py @@ -9,21 +9,18 @@ import ccxt import pytest from pandas import DataFrame -from freqtrade.exceptions import (DDosProtection, DependencyException, - InvalidOrderException, OperationalException, - TemporaryError) +from freqtrade.exceptions import (DDosProtection, DependencyException, InvalidOrderException, + OperationalException, TemporaryError) from freqtrade.exchange import Binance, Exchange, Kraken -from freqtrade.exchange.common import (API_RETRY_COUNT, API_FETCH_ORDER_RETRY_COUNT, +from freqtrade.exchange.common import (API_FETCH_ORDER_RETRY_COUNT, API_RETRY_COUNT, calculate_backoff) -from freqtrade.exchange.exchange import (market_is_active, - timeframe_to_minutes, - timeframe_to_msecs, - timeframe_to_next_date, - timeframe_to_prev_date, +from freqtrade.exchange.exchange import (market_is_active, timeframe_to_minutes, timeframe_to_msecs, + timeframe_to_next_date, timeframe_to_prev_date, timeframe_to_seconds) from freqtrade.resolvers.exchange_resolver import ExchangeResolver from tests.conftest import get_patched_exchange, log_has, log_has_re + # Make sure to always keep one exchange here which is NOT subclassed!! EXCHANGES = ['bittrex', 'binance', 'kraken', 'ftx'] diff --git a/tests/exchange/test_ftx.py b/tests/exchange/test_ftx.py index 16789af2c..17cfb26fa 100644 --- a/tests/exchange/test_ftx.py +++ b/tests/exchange/test_ftx.py @@ -10,6 +10,7 @@ from tests.conftest import get_patched_exchange from .test_exchange import ccxt_exceptionhandlers + STOPLOSS_ORDERTYPE = 'stop' diff --git a/tests/exchange/test_kraken.py b/tests/exchange/test_kraken.py index 8f774a7ec..31b79a202 100644 --- a/tests/exchange/test_kraken.py +++ b/tests/exchange/test_kraken.py @@ -8,6 +8,7 @@ from freqtrade.exceptions import DependencyException, InvalidOrderException from tests.conftest import get_patched_exchange from tests.exchange.test_exchange import ccxt_exceptionhandlers + STOPLOSS_ORDERTYPE = 'stop-loss' diff --git a/tests/optimize/__init__.py b/tests/optimize/__init__.py index 8bc66f02c..306850ff6 100644 --- a/tests/optimize/__init__.py +++ b/tests/optimize/__init__.py @@ -6,6 +6,7 @@ from pandas import DataFrame from freqtrade.exchange import timeframe_to_minutes from freqtrade.strategy.interface import SellType + tests_start_time = arrow.get(2018, 10, 3) tests_timeframe = '1h' diff --git a/tests/optimize/test_backtest_detail.py b/tests/optimize/test_backtest_detail.py index f6ac95aeb..a5de64fe4 100644 --- a/tests/optimize/test_backtest_detail.py +++ b/tests/optimize/test_backtest_detail.py @@ -11,6 +11,7 @@ from tests.conftest import patch_exchange from tests.optimize import (BTContainer, BTrade, _build_backtest_dataframe, _get_frame_time_from_offset, tests_timeframe) + # Test 0: Sell with signal sell in candle 3 # Test with Stop-loss at 1% tc0 = BTContainer(data=[ diff --git a/tests/optimize/test_backtesting.py b/tests/optimize/test_backtesting.py index 78a7130f9..45cbea68e 100644 --- a/tests/optimize/test_backtesting.py +++ b/tests/optimize/test_backtesting.py @@ -10,8 +10,7 @@ import pytest from arrow import Arrow from freqtrade import constants -from freqtrade.commands.optimize_commands import (setup_optimize_configuration, - start_backtesting) +from freqtrade.commands.optimize_commands import setup_optimize_configuration, start_backtesting from freqtrade.configuration import TimeRange from freqtrade.data import history from freqtrade.data.btanalysis import BT_DATA_COLUMNS, evaluate_result_multi @@ -26,6 +25,7 @@ from freqtrade.strategy.interface import SellType from tests.conftest import (get_args, log_has, log_has_re, patch_exchange, patched_configuration_load_config_file) + ORDER_TYPES = [ { 'buy': 'limit', diff --git a/tests/optimize/test_hyperopt.py b/tests/optimize/test_hyperopt.py index d58b91209..bf8a720b5 100644 --- a/tests/optimize/test_hyperopt.py +++ b/tests/optimize/test_hyperopt.py @@ -1,9 +1,9 @@ # pragma pylint: disable=missing-docstring,W0212,C0103 import locale import logging +from copy import deepcopy from datetime import datetime from pathlib import Path -from copy import deepcopy from typing import Dict, List from unittest.mock import MagicMock, PropertyMock @@ -13,14 +13,12 @@ from arrow import Arrow from filelock import Timeout from freqtrade import constants -from freqtrade.commands.optimize_commands import (setup_optimize_configuration, - start_hyperopt) +from freqtrade.commands.optimize_commands import setup_optimize_configuration, start_hyperopt from freqtrade.data.history import load_data from freqtrade.exceptions import DependencyException, OperationalException from freqtrade.optimize.default_hyperopt_loss import DefaultHyperOptLoss from freqtrade.optimize.hyperopt import Hyperopt -from freqtrade.resolvers.hyperopt_resolver import (HyperOptLossResolver, - HyperOptResolver) +from freqtrade.resolvers.hyperopt_resolver import HyperOptLossResolver, HyperOptResolver from freqtrade.state import RunMode from freqtrade.strategy.interface import SellType from tests.conftest import (get_args, log_has, log_has_re, patch_exchange, diff --git a/tests/optimize/test_optimize_reports.py b/tests/optimize/test_optimize_reports.py index b484e4390..d04929164 100644 --- a/tests/optimize/test_optimize_reports.py +++ b/tests/optimize/test_optimize_reports.py @@ -5,21 +5,17 @@ from pathlib import Path import pandas as pd import pytest from arrow import Arrow + from freqtrade.configuration import TimeRange from freqtrade.constants import LAST_BT_RESULT_FN from freqtrade.data import history -from freqtrade.data.btanalysis import (get_latest_backtest_filename, - load_backtest_data) +from freqtrade.data.btanalysis import get_latest_backtest_filename, load_backtest_data from freqtrade.edge import PairInfo -from freqtrade.optimize.optimize_reports import (generate_backtest_stats, - generate_daily_stats, - generate_edge_table, - generate_pair_metrics, +from freqtrade.optimize.optimize_reports import (generate_backtest_stats, generate_daily_stats, + generate_edge_table, generate_pair_metrics, generate_sell_reason_stats, - generate_strategy_metrics, - store_backtest_stats, - text_table_bt_results, - text_table_sell_reason, + generate_strategy_metrics, store_backtest_stats, + text_table_bt_results, text_table_sell_reason, text_table_strategy) from freqtrade.resolvers.strategy_resolver import StrategyResolver from freqtrade.strategy.interface import SellType diff --git a/tests/rpc/test_rpc.py b/tests/rpc/test_rpc.py index c2dee6439..977dfbc20 100644 --- a/tests/rpc/test_rpc.py +++ b/tests/rpc/test_rpc.py @@ -13,8 +13,7 @@ from freqtrade.persistence import Trade from freqtrade.rpc import RPC, RPCException from freqtrade.rpc.fiat_convert import CryptoToFiatConverter from freqtrade.state import State -from tests.conftest import (create_mock_trades, get_patched_freqtradebot, - patch_get_signal) +from tests.conftest import create_mock_trades, get_patched_freqtradebot, patch_get_signal # Functions for recurrent object patching diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index 626586a4a..fea7b1c73 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -14,8 +14,8 @@ from freqtrade.loggers import setup_logging, setup_logging_pre from freqtrade.persistence import Trade from freqtrade.rpc.api_server import BASE_URI, ApiServer from freqtrade.state import State -from tests.conftest import (create_mock_trades, get_patched_freqtradebot, - log_has, patch_get_signal) +from tests.conftest import create_mock_trades, get_patched_freqtradebot, log_has, patch_get_signal + _TEST_USER = "FreqTrader" _TEST_PASS = "SuperSecurePassword1!" diff --git a/tests/rpc/test_rpc_manager.py b/tests/rpc/test_rpc_manager.py index e8d0f648e..4b715fc37 100644 --- a/tests/rpc/test_rpc_manager.py +++ b/tests/rpc/test_rpc_manager.py @@ -1,10 +1,10 @@ # pragma pylint: disable=missing-docstring, C0103 -import time import logging +import time from unittest.mock import MagicMock -from freqtrade.rpc import RPCMessageType, RPCManager -from tests.conftest import log_has, get_patched_freqtradebot +from freqtrade.rpc import RPCManager, RPCMessageType +from tests.conftest import get_patched_freqtradebot, log_has def test__init__(mocker, default_conf) -> None: diff --git a/tests/rpc/test_rpc_telegram.py b/tests/rpc/test_rpc_telegram.py index 3958a825a..aee88104b 100644 --- a/tests/rpc/test_rpc_telegram.py +++ b/tests/rpc/test_rpc_telegram.py @@ -23,9 +23,8 @@ from freqtrade.rpc import RPCMessageType from freqtrade.rpc.telegram import Telegram, authorized_only from freqtrade.state import State from freqtrade.strategy.interface import SellType -from tests.conftest import (create_mock_trades, get_patched_freqtradebot, - log_has, patch_exchange, patch_get_signal, - patch_whitelist) +from tests.conftest import (create_mock_trades, get_patched_freqtradebot, log_has, patch_exchange, + patch_get_signal, patch_whitelist) class DummyCls(Telegram): diff --git a/tests/strategy/strats/legacy_strategy.py b/tests/strategy/strats/legacy_strategy.py index 9cbce0ad5..1e7bb5e1e 100644 --- a/tests/strategy/strats/legacy_strategy.py +++ b/tests/strategy/strats/legacy_strategy.py @@ -1,12 +1,13 @@ # --- Do not remove these libs --- -from freqtrade.strategy.interface import IStrategy -from pandas import DataFrame -# -------------------------------- - # Add your lib to import here import talib.abstract as ta +from pandas import DataFrame +from freqtrade.strategy.interface import IStrategy + + +# -------------------------------- # This class is a sample. Feel free to customize it. class TestStrategyLegacy(IStrategy): diff --git a/tests/strategy/test_interface.py b/tests/strategy/test_interface.py index f1b5d0244..729b14f7b 100644 --- a/tests/strategy/test_interface.py +++ b/tests/strategy/test_interface.py @@ -19,6 +19,7 @@ from tests.conftest import log_has, log_has_re from .strats.default_strategy import DefaultStrategy + # Avoid to reinit the same object again and again _STRATEGY = DefaultStrategy(config={}) _STRATEGY.dp = DataProvider({}, None, None) diff --git a/tests/strategy/test_strategy_helpers.py b/tests/strategy/test_strategy_helpers.py index 4b29bf304..1d3e80d24 100644 --- a/tests/strategy/test_strategy_helpers.py +++ b/tests/strategy/test_strategy_helpers.py @@ -1,5 +1,5 @@ -import pandas as pd import numpy as np +import pandas as pd from freqtrade.strategy import merge_informative_pair, timeframe_to_minutes diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 4428fe240..7d6c81f74 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -11,20 +11,18 @@ import pytest from jsonschema import ValidationError from freqtrade.commands import Arguments -from freqtrade.configuration import (Configuration, check_exchange, - remove_credentials, +from freqtrade.configuration import (Configuration, check_exchange, remove_credentials, validate_config_consistency) from freqtrade.configuration.config_validation import validate_config_schema -from freqtrade.configuration.deprecated_settings import ( - check_conflicting_settings, process_deprecated_setting, - process_temporary_deprecated_settings) +from freqtrade.configuration.deprecated_settings import (check_conflicting_settings, + process_deprecated_setting, + process_temporary_deprecated_settings) from freqtrade.configuration.load_config import load_config_file, log_config_error_range from freqtrade.constants import DEFAULT_DB_DRYRUN_URL, DEFAULT_DB_PROD_URL from freqtrade.exceptions import OperationalException from freqtrade.loggers import _set_loggers, setup_logging, setup_logging_pre from freqtrade.state import RunMode -from tests.conftest import (log_has, log_has_re, - patched_configuration_load_config_file) +from tests.conftest import log_has, log_has_re, patched_configuration_load_config_file @pytest.fixture(scope="function") diff --git a/tests/test_directory_operations.py b/tests/test_directory_operations.py index 71c91549f..a8058c514 100644 --- a/tests/test_directory_operations.py +++ b/tests/test_directory_operations.py @@ -4,8 +4,7 @@ from unittest.mock import MagicMock import pytest -from freqtrade.configuration.directory_operations import (copy_sample_files, - create_datadir, +from freqtrade.configuration.directory_operations import (copy_sample_files, create_datadir, create_userdata_dir) from freqtrade.exceptions import OperationalException from tests.conftest import log_has, log_has_re diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py index 0c12c05bb..8af3e12a7 100644 --- a/tests/test_freqtradebot.py +++ b/tests/test_freqtradebot.py @@ -10,12 +10,10 @@ from unittest.mock import ANY, MagicMock, PropertyMock import arrow import pytest -from freqtrade.constants import (CANCEL_REASON, MATH_CLOSE_PREC, - UNLIMITED_STAKE_AMOUNT) -from freqtrade.exceptions import (DependencyException, ExchangeError, - InsufficientFundsError, - InvalidOrderException, OperationalException, - PricingError, TemporaryError) +from freqtrade.constants import CANCEL_REASON, MATH_CLOSE_PREC, UNLIMITED_STAKE_AMOUNT +from freqtrade.exceptions import (DependencyException, ExchangeError, InsufficientFundsError, + InvalidOrderException, OperationalException, PricingError, + TemporaryError) from freqtrade.freqtradebot import FreqtradeBot from freqtrade.persistence import Trade from freqtrade.persistence.models import Order @@ -23,15 +21,12 @@ from freqtrade.rpc import RPCMessageType from freqtrade.state import RunMode, State from freqtrade.strategy.interface import SellCheckTuple, SellType from freqtrade.worker import Worker -from tests.conftest import (create_mock_trades, get_patched_freqtradebot, - get_patched_worker, log_has, log_has_re, - patch_edge, patch_exchange, patch_get_signal, +from tests.conftest import (create_mock_trades, get_patched_freqtradebot, get_patched_worker, + log_has, log_has_re, patch_edge, patch_exchange, patch_get_signal, patch_wallet, patch_whitelist) -from tests.conftest_trades import (MOCK_TRADE_COUNT, mock_order_1, - mock_order_2, mock_order_2_sell, - mock_order_3, mock_order_3_sell, - mock_order_4, mock_order_5_stoploss, - mock_order_6_sell) +from tests.conftest_trades import (MOCK_TRADE_COUNT, mock_order_1, mock_order_2, mock_order_2_sell, + mock_order_3, mock_order_3_sell, mock_order_4, + mock_order_5_stoploss, mock_order_6_sell) def patch_RPCManager(mocker) -> MagicMock: diff --git a/tests/test_indicators.py b/tests/test_indicators.py index 2f9bdc0f9..8d02330a1 100644 --- a/tests/test_indicators.py +++ b/tests/test_indicators.py @@ -1,7 +1,8 @@ -import freqtrade.vendor.qtpylib.indicators as qtpylib import numpy as np import pandas as pd +import freqtrade.vendor.qtpylib.indicators as qtpylib + def test_crossed_numpy_types(): """ diff --git a/tests/test_main.py b/tests/test_main.py index dd0c877e8..9106d4c12 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -1,11 +1,11 @@ # pragma pylint: disable=missing-docstring from copy import deepcopy +from pathlib import Path from unittest.mock import MagicMock, PropertyMock import pytest -from pathlib import Path from freqtrade.commands import Arguments from freqtrade.exceptions import FreqtradeException, OperationalException from freqtrade.freqtradebot import FreqtradeBot diff --git a/tests/test_misc.py b/tests/test_misc.py index a185cbba4..6dcd9fbe5 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -7,9 +7,8 @@ from unittest.mock import MagicMock import pytest from freqtrade.data.converter import ohlcv_to_dataframe -from freqtrade.misc import (datesarray_to_datetimearray, file_dump_json, - file_load_json, format_ms_time, pair_to_filename, - plural, render_template, +from freqtrade.misc import (datesarray_to_datetimearray, file_dump_json, file_load_json, + format_ms_time, pair_to_filename, plural, render_template, render_template_with_fallback, safe_value_fallback, safe_value_fallback2, shorten_date) diff --git a/tests/test_plotting.py b/tests/test_plotting.py index bcababbf1..401f66b60 100644 --- a/tests/test_plotting.py +++ b/tests/test_plotting.py @@ -13,13 +13,10 @@ from freqtrade.configuration import TimeRange from freqtrade.data import history from freqtrade.data.btanalysis import create_cum_profit, load_backtest_data from freqtrade.exceptions import OperationalException -from freqtrade.plot.plotting import (add_indicators, add_profit, - create_plotconfig, - generate_candlestick_graph, - generate_plot_filename, - generate_profit_graph, init_plotscript, - load_and_plot_trades, plot_profit, - plot_trades, store_plot_file) +from freqtrade.plot.plotting import (add_indicators, add_profit, create_plotconfig, + generate_candlestick_graph, generate_plot_filename, + generate_profit_graph, init_plotscript, load_and_plot_trades, + plot_profit, plot_trades, store_plot_file) from freqtrade.resolvers import StrategyResolver from tests.conftest import get_args, log_has, log_has_re, patch_exchange diff --git a/tests/test_talib.py b/tests/test_talib.py index 4effc129b..f526fdd4d 100644 --- a/tests/test_talib.py +++ b/tests/test_talib.py @@ -1,5 +1,5 @@ -import talib.abstract as ta import pandas as pd +import talib.abstract as ta def test_talib_bollingerbands_near_zero_values():