chore: fix RUF043 violations

This commit is contained in:
Matthias
2025-09-15 19:20:20 +02:00
parent 95a710d4a8
commit 9f436dcd1e
15 changed files with 51 additions and 46 deletions

View File

@@ -444,7 +444,7 @@ def test_backtesting_start_no_data(default_conf, mocker, caplog, testdatadir) ->
backtesting = Backtesting(default_conf)
backtesting._set_strategy(backtesting.strategylist[0])
with pytest.raises(OperationalException, match="No data found. Terminating."):
with pytest.raises(OperationalException, match=r"No data found. Terminating\."):
backtesting.start()
@@ -465,7 +465,7 @@ def test_backtesting_no_pair_left(default_conf, mocker) -> None:
default_conf["export"] = "none"
default_conf["timerange"] = "20180101-20180102"
with pytest.raises(OperationalException, match="No pair in whitelist."):
with pytest.raises(OperationalException, match=r"No pair in whitelist\."):
Backtesting(default_conf)
default_conf.update(
@@ -476,7 +476,7 @@ def test_backtesting_no_pair_left(default_conf, mocker) -> None:
)
with pytest.raises(
OperationalException, match="Detail timeframe must be smaller than strategy timeframe."
OperationalException, match=r"Detail timeframe must be smaller than strategy timeframe\."
):
Backtesting(default_conf)
@@ -517,7 +517,7 @@ def test_backtesting_pairlist_list(default_conf, mocker, tickers) -> None:
default_conf["strategy_list"] = [CURRENT_TEST_STRATEGY, "StrategyTestV2"]
with pytest.raises(
OperationalException,
match="PrecisionFilter not allowed for backtesting multiple strategies.",
match=r"PrecisionFilter not allowed for backtesting multiple strategies\.",
):
Backtesting(default_conf)

View File

@@ -280,7 +280,7 @@ def test_start_no_data(mocker, hyperopt_conf, tmp_path) -> None:
"5",
]
pargs = get_args(args)
with pytest.raises(OperationalException, match="No data found. Terminating."):
with pytest.raises(OperationalException, match=r"No data found. Terminating\."):
start_hyperopt(pargs)
# Cleanup since that failed hyperopt start leaves a lockfile.
@@ -1127,7 +1127,7 @@ def test_in_strategy_auto_hyperopt(mocker, hyperopt_conf, tmp_path, fee) -> None
assert opt.backtesting.strategy.max_open_trades != 1
opt.custom_hyperopt.generate_estimator = lambda *args, **kwargs: "ET1"
with pytest.raises(OperationalException, match="Optuna Sampler ET1 not supported."):
with pytest.raises(OperationalException, match=r"Optuna Sampler ET1 not supported\."):
opt.get_optimizer(42)

View File

@@ -11,8 +11,8 @@ from freqtrade.resolvers.hyperopt_resolver import HyperOptLossResolver
def test_hyperoptlossresolver_noname(default_conf):
with pytest.raises(
OperationalException,
match="No Hyperopt loss set. Please use `--hyperopt-loss` to specify "
"the Hyperopt-Loss class to use.",
match=r"No Hyperopt loss set. Please use `--hyperopt-loss` to specify "
r"the Hyperopt-Loss class to use\.",
):
HyperOptLossResolver.load_hyperoptloss(default_conf)