diff --git a/tests/conftest.py b/tests/conftest.py index 45cd450c7..892b49d8c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -165,7 +165,7 @@ def generate_trades_history(n_rows, start_date: datetime | None = None, days=5): ) df["date"] = pd.to_datetime(df["timestamp"], unit="ms", utc=True) df = df.sort_values("timestamp").reset_index(drop=True) - assert list(df.columns) == constants.DEFAULT_TRADES_COLUMNS + ["date"] + assert list(df.columns) == [*constants.DEFAULT_TRADES_COLUMNS, "date"] return df diff --git a/tests/data/test_entryexitanalysis.py b/tests/data/test_entryexitanalysis.py index 509c9b92c..63ac3c1a3 100644 --- a/tests/data/test_entryexitanalysis.py +++ b/tests/data/test_entryexitanalysis.py @@ -139,7 +139,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock( # test group 0 and indicator list args = get_args( - base_args + ["--analysis-groups", "0", "--indicator-list", "close", "rsi", "profit_abs"] + [*base_args, "--analysis-groups", "0", "--indicator-list", "close", "rsi", "profit_abs"] ) start_analysis_entries_exits(args) captured = capsys.readouterr() @@ -172,7 +172,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock( assert "profit_abs" in captured.out # test group 1 - args = get_args(base_args + ["--analysis-groups", "1"]) + args = get_args([*base_args, "--analysis-groups", "1"]) start_analysis_entries_exits(args) captured = capsys.readouterr() assert "enter_tag_long_a" in captured.out @@ -185,7 +185,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock( assert "0" in captured.out # test group 2 - args = get_args(base_args + ["--analysis-groups", "2"]) + args = get_args([*base_args, "--analysis-groups", "2"]) start_analysis_entries_exits(args) captured = capsys.readouterr() assert "enter_tag_long_a" in captured.out @@ -200,7 +200,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock( assert "2.5" in captured.out # test group 3 - args = get_args(base_args + ["--analysis-groups", "3"]) + args = get_args([*base_args, "--analysis-groups", "3"]) start_analysis_entries_exits(args) captured = capsys.readouterr() assert "LTC/BTC" in captured.out @@ -215,7 +215,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock( assert "2" in captured.out # test group 4 - args = get_args(base_args + ["--analysis-groups", "4"]) + args = get_args([*base_args, "--analysis-groups", "4"]) start_analysis_entries_exits(args) captured = capsys.readouterr() assert "LTC/BTC" in captured.out @@ -235,7 +235,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock( assert "2.5" in captured.out # test group 5 - args = get_args(base_args + ["--analysis-groups", "5"]) + args = get_args([*base_args, "--analysis-groups", "5"]) start_analysis_entries_exits(args) captured = capsys.readouterr() assert "exit_signal" in captured.out @@ -245,7 +245,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock( # test date filtering args = get_args( - base_args + ["--analysis-groups", "0", "1", "2", "--timerange", "20180129-20180130"] + [*base_args, "--analysis-groups", "0", "1", "2", "--timerange", "20180129-20180130"] ) start_analysis_entries_exits(args) captured = capsys.readouterr() @@ -253,7 +253,7 @@ def test_backtest_analysis_on_entry_and_rejected_signals_nomock( assert "enter_tag_long_b" not in captured.out # Due to the backtest mock, there's no rejected signals generated. - args = get_args(base_args + ["--rejected-signals"]) + args = get_args([*base_args, "--rejected-signals"]) start_analysis_entries_exits(args) captured = capsys.readouterr() assert "no rejected signals" in captured.out @@ -379,8 +379,8 @@ def test_backtest_analysis_with_invalid_config( # test with both entry and exit only arguments args = get_args( - base_args - + [ + [ + *base_args, "--analysis-groups", "0", "--indicator-list", @@ -518,8 +518,8 @@ def test_backtest_analysis_on_entry_and_rejected_signals_only_entry_signals( # test group 0 and indicator list args = get_args( - base_args - + [ + [ + *base_args, "--analysis-groups", "0", "--indicator-list", diff --git a/tests/optimize/__init__.py b/tests/optimize/__init__.py index cdc42956f..38d86439c 100644 --- a/tests/optimize/__init__.py +++ b/tests/optimize/__init__.py @@ -69,8 +69,8 @@ def _build_backtest_dataframe(data): ] if len(data[0]) == 8: # No short columns - data = [d + [0, 0] for d in data] - columns = columns + ["enter_tag"] if len(data[0]) == 11 else columns + data = [[*d, 0, 0] for d in data] + columns = [*columns, "enter_tag"] if len(data[0]) == 11 else columns frame = DataFrame.from_records(data, columns=columns) frame["date"] = frame["date"].apply(_get_frame_time_from_offset) diff --git a/tests/plugins/test_pairlist.py b/tests/plugins/test_pairlist.py index a4f66a702..0f133242b 100644 --- a/tests/plugins/test_pairlist.py +++ b/tests/plugins/test_pairlist.py @@ -281,7 +281,7 @@ def test_remove_logs_for_pairs_already_in_blacklist(mocker, markets, static_pl_c for _ in range(3): new_whitelist = freqtrade.pairlists.verify_blacklist( - whitelist + ["BLK/BTC"], logger.warning + [*whitelist, "BLK/BTC"], logger.warning ) # Ensure that the pair is removed from the white list, and properly logged. assert set(whitelist) == set(new_whitelist) @@ -2032,11 +2032,7 @@ def test_expand_pairlist(wildcardlist, pairs, expected): }, } assert sorted(dynamic_expand_pairlist(conf, pairs)) == sorted( - expected - + [ - "BTC/USDT:USDT", - "XRP/BUSD", - ] + [*expected, "BTC/USDT:USDT", "XRP/BUSD"] ) @@ -2138,7 +2134,7 @@ def test_ProducerPairlist(mocker, whitelist_conf, markets): dp = DataProvider(whitelist_conf, exchange, None) pairs = ["ETH/BTC", "LTC/BTC", "XRP/BTC"] # different producer - dp._set_producer_pairs(pairs + ["MEEP/USDT"], "default") + dp._set_producer_pairs([*pairs, "MEEP/USDT"], "default") pm = PairListManager(exchange, whitelist_conf, dp) pm.refresh_pairlist() assert pm.whitelist == [] @@ -2161,7 +2157,7 @@ def test_ProducerPairlist(mocker, whitelist_conf, markets): pm = PairListManager(exchange, whitelist_conf, dp) pm.refresh_pairlist() assert len(pm.whitelist) == 4 - assert pm.whitelist == ["TKN/BTC"] + pairs + assert pm.whitelist == ["TKN/BTC", *pairs] @pytest.mark.usefixtures("init_persistence")