Fix odd formatting by ruff format

This commit is contained in:
Matthias
2024-05-12 17:51:21 +02:00
parent 876a8f9e3e
commit a9732c6195
35 changed files with 210 additions and 192 deletions
+3 -3
View File
@@ -186,7 +186,7 @@ def test_list_timeframes(mocker, capsys):
start_list_timeframes(get_args(args))
captured = capsys.readouterr()
assert re.match(
"Timeframes available for the exchange `Bybit`: " "1m, 5m, 30m, 1h, 1d", captured.out
"Timeframes available for the exchange `Bybit`: 1m, 5m, 30m, 1h, 1d", captured.out
)
# Test with --exchange bybit
@@ -198,7 +198,7 @@ def test_list_timeframes(mocker, capsys):
start_list_timeframes(get_args(args))
captured = capsys.readouterr()
assert re.match(
"Timeframes available for the exchange `Bybit`: " "1m, 5m, 30m, 1h, 1d", captured.out
"Timeframes available for the exchange `Bybit`: 1m, 5m, 30m, 1h, 1d", captured.out
)
api_mock.timeframes = {
@@ -222,7 +222,7 @@ def test_list_timeframes(mocker, capsys):
start_list_timeframes(get_args(args))
captured = capsys.readouterr()
assert re.match(
"Timeframes available for the exchange `Binance`: " "1m, 5m, 15m, 30m, 1h, 6h, 12h, 1d, 3d",
"Timeframes available for the exchange `Binance`: 1m, 5m, 15m, 30m, 1h, 6h, 12h, 1d, 3d",
captured.out,
)
+2 -2
View File
@@ -415,7 +415,7 @@ def test_load_partial_missing(testdatadir, caplog) -> None:
assert td != len(data["UNITTEST/BTC"])
start_real = data["UNITTEST/BTC"].iloc[0, 0]
assert log_has(
f"UNITTEST/BTC, spot, 5m, " f"data starts at {start_real.strftime(DATETIME_PRINT_FORMAT)}",
f"UNITTEST/BTC, spot, 5m, data starts at {start_real.strftime(DATETIME_PRINT_FORMAT)}",
caplog,
)
# Make sure we start fresh - test missing data at end
@@ -435,7 +435,7 @@ def test_load_partial_missing(testdatadir, caplog) -> None:
# Shift endtime with +5
end_real = data["UNITTEST/BTC"].iloc[-1, 0].to_pydatetime()
assert log_has(
f"UNITTEST/BTC, spot, 5m, " f"data ends at {end_real.strftime(DATETIME_PRINT_FORMAT)}",
f"UNITTEST/BTC, spot, 5m, data ends at {end_real.strftime(DATETIME_PRINT_FORMAT)}",
caplog,
)
+2 -2
View File
@@ -645,7 +645,7 @@ def test_validate_stakecurrency_error(default_conf, mocker, caplog):
mocker.patch(f"{EXMS}._load_async_markets")
with pytest.raises(
ConfigurationError,
match=r"XRP is not available as stake on .*" "Available currencies are: BTC, ETH, USDT",
match=r"XRP is not available as stake on .*Available currencies are: BTC, ETH, USDT",
):
Exchange(default_conf)
@@ -2328,7 +2328,7 @@ def test_refresh_latest_ohlcv(mocker, default_conf, caplog, candle_type) -> None
assert exchange._api_async.fetch_ohlcv.call_count == 0
assert log_has(
f"Using cached candle (OHLCV) data for {pairs[0][0]}, " f"{pairs[0][1]}, {candle_type} ...",
f"Using cached candle (OHLCV) data for {pairs[0][0]}, {pairs[0][1]}, {candle_type} ...",
caplog,
)
caplog.clear()
+1 -1
View File
@@ -3771,7 +3771,7 @@ def test_get_real_amount_quote_dust(
assert freqtrade.get_real_amount(trade, buy_order_fee, order_obj) is None
assert walletmock.call_count == 1
assert log_has_re(
r"Fee amount for Trade.* was in base currency " "- Eating Fee 0.008 into dust", caplog
r"Fee amount for Trade.* was in base currency - Eating Fee 0.008 into dust", caplog
)
+11 -13
View File
@@ -393,9 +393,7 @@ def test_backtesting_start(default_conf, mocker, caplog) -> None:
backtesting.strategy.bot_start = MagicMock()
backtesting.start()
# check the logs, that will contain the backtest result
exists = [
"Backtesting with data from 2017-11-14 21:17:00 " "up to 2017-11-14 22:59:00 (0 days)."
]
exists = ["Backtesting with data from 2017-11-14 21:17:00 up to 2017-11-14 22:59:00 (0 days)."]
for line in exists:
assert log_has(line, caplog)
assert backtesting.strategy.dp._pairlists is not None
@@ -1574,8 +1572,8 @@ def test_backtest_start_timerange(default_conf, mocker, caplog, testdatadir):
"Ignoring max_open_trades (--disable-max-market-positions was used) ...",
"Parameter --timerange detected: 1510694220-1510700340 ...",
f"Using data directory: {testdatadir} ...",
"Loading data from 2017-11-14 20:57:00 " "up to 2017-11-14 22:59:00 (0 days).",
"Backtesting with data from 2017-11-14 21:17:00 " "up to 2017-11-14 22:59:00 (0 days).",
"Loading data from 2017-11-14 20:57:00 up to 2017-11-14 22:59:00 (0 days).",
"Backtesting with data from 2017-11-14 21:17:00 up to 2017-11-14 22:59:00 (0 days).",
"Parameter --enable-position-stacking detected ...",
]
@@ -1665,8 +1663,8 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
"Ignoring max_open_trades (--disable-max-market-positions was used) ...",
"Parameter --timerange detected: 1510694220-1510700340 ...",
f"Using data directory: {testdatadir} ...",
"Loading data from 2017-11-14 20:57:00 " "up to 2017-11-14 22:59:00 (0 days).",
"Backtesting with data from 2017-11-14 21:17:00 " "up to 2017-11-14 22:59:00 (0 days).",
"Loading data from 2017-11-14 20:57:00 up to 2017-11-14 22:59:00 (0 days).",
"Backtesting with data from 2017-11-14 21:17:00 up to 2017-11-14 22:59:00 (0 days).",
"Parameter --enable-position-stacking detected ...",
f"Running backtesting for Strategy {CURRENT_TEST_STRATEGY}",
"Running backtesting for Strategy StrategyTestV2",
@@ -1799,8 +1797,8 @@ def test_backtest_start_multi_strat_nomock(default_conf, mocker, caplog, testdat
"Ignoring max_open_trades (--disable-max-market-positions was used) ...",
"Parameter --timerange detected: 1510694220-1510700340 ...",
f"Using data directory: {testdatadir} ...",
"Loading data from 2017-11-14 20:57:00 " "up to 2017-11-14 22:59:00 (0 days).",
"Backtesting with data from 2017-11-14 21:17:00 " "up to 2017-11-14 22:59:00 (0 days).",
"Loading data from 2017-11-14 20:57:00 up to 2017-11-14 22:59:00 (0 days).",
"Backtesting with data from 2017-11-14 21:17:00 up to 2017-11-14 22:59:00 (0 days).",
"Parameter --enable-position-stacking detected ...",
f"Running backtesting for Strategy {CURRENT_TEST_STRATEGY}",
"Running backtesting for Strategy StrategyTestV2",
@@ -1975,8 +1973,8 @@ def test_backtest_start_nomock_futures(default_conf_usdt, mocker, caplog, testda
exists = [
"Parameter -i/--timeframe detected ... Using timeframe: 1h ...",
f"Using data directory: {testdatadir} ...",
"Loading data from 2021-11-17 01:00:00 " "up to 2021-11-21 04:00:00 (4 days).",
"Backtesting with data from 2021-11-17 21:00:00 " "up to 2021-11-21 04:00:00 (3 days).",
"Loading data from 2021-11-17 01:00:00 up to 2021-11-21 04:00:00 (4 days).",
"Backtesting with data from 2021-11-17 21:00:00 up to 2021-11-21 04:00:00 (3 days).",
"XRP/USDT:USDT, funding_rate, 8h, data starts at 2021-11-18 00:00:00",
"XRP/USDT:USDT, mark, 8h, data starts at 2021-11-18 00:00:00",
f"Running backtesting for Strategy {CURRENT_TEST_STRATEGY}",
@@ -2112,8 +2110,8 @@ def test_backtest_start_multi_strat_nomock_detail(
"Parameter -i/--timeframe detected ... Using timeframe: 5m ...",
"Parameter --timeframe-detail detected, using 1m for intra-candle backtesting ...",
f"Using data directory: {testdatadir} ...",
"Loading data from 2019-10-11 00:00:00 " "up to 2019-10-13 11:15:00 (2 days).",
"Backtesting with data from 2019-10-11 01:40:00 " "up to 2019-10-13 11:15:00 (2 days).",
"Loading data from 2019-10-11 00:00:00 up to 2019-10-13 11:15:00 (2 days).",
"Backtesting with data from 2019-10-11 01:40:00 up to 2019-10-13 11:15:00 (2 days).",
f"Running backtesting for Strategy {CURRENT_TEST_STRATEGY}",
]
+1 -1
View File
@@ -111,7 +111,7 @@ def test_load_strategy_noname(default_conf):
default_conf["strategy"] = ""
with pytest.raises(
OperationalException,
match="No strategy set. Please use `--strategy` to specify " "the strategy class to use.",
match="No strategy set. Please use `--strategy` to specify the strategy class to use.",
):
StrategyResolver.load_strategy(default_conf)
+2 -2
View File
@@ -664,7 +664,7 @@ def test_validate_max_open_trades(default_conf):
default_conf["stake_amount"] = "unlimited"
with pytest.raises(
OperationalException,
match="`max_open_trades` and `stake_amount` " "cannot both be unlimited.",
match="`max_open_trades` and `stake_amount` cannot both be unlimited.",
):
validate_config_consistency(default_conf)
@@ -767,7 +767,7 @@ def test_validate_edge2(edge_conf):
)
with pytest.raises(
OperationalException,
match="Edge requires `use_exit_signal` to be True, " "otherwise no sells will happen.",
match="Edge requires `use_exit_signal` to be True, otherwise no sells will happen.",
):
validate_config_consistency(edge_conf)