Merge pull request #10099 from cclauss/codespell

Fix typos discovered by codespell
This commit is contained in:
Matthias
2024-04-19 07:37:29 +02:00
committed by GitHub
62 changed files with 102 additions and 98 deletions

View File

@@ -1609,4 +1609,4 @@ def test_start_show_config(capsys, caplog):
assert "Your combined configuration is:" in captured.out
assert '"max_open_trades":' in captured.out
assert '"secret": "REDACTED"' not in captured.out
assert log_has_re(r'Sensitive information will be shown in the upcomming output.*', caplog)
assert log_has_re(r'Sensitive information will be shown in the upcoming output.*', caplog)

View File

@@ -49,7 +49,7 @@ def pytest_addoption(parser):
def pytest_configure(config):
config.addinivalue_line(
"markers", "longrun: mark test that is running slowly and should not be run regularily"
"markers", "longrun: mark test that is running slowly and should not be run regularly"
)
if not config.option.longrun:
setattr(config.option, 'markexpr', 'not longrun')

View File

@@ -482,12 +482,12 @@ def test_calculate_max_drawdown2():
assert drawdown == 0.043965
@pytest.mark.parametrize('profits,relative,highd,lowd,result,result_rel', [
@pytest.mark.parametrize('profits,relative,highd,lowdays,result,result_rel', [
([0.0, -500.0, 500.0, 10000.0, -1000.0], False, 3, 4, 1000.0, 0.090909),
([0.0, -500.0, 500.0, 10000.0, -1000.0], True, 0, 1, 500.0, 0.5),
])
def test_calculate_max_drawdown_abs(profits, relative, highd, lowd, result, result_rel):
def test_calculate_max_drawdown_abs(profits, relative, highd, lowdays, result, result_rel):
"""
Test case from issue https://github.com/freqtrade/freqtrade/issues/6655
[1000, 500, 1000, 11000, 10000] # absolute results
@@ -507,7 +507,7 @@ def test_calculate_max_drawdown_abs(profits, relative, highd, lowd, result, resu
assert isinstance(drawdown, float)
assert isinstance(drawdown_rel, float)
assert hdate == init_date + timedelta(days=highd)
assert ldate == init_date + timedelta(days=lowd)
assert ldate == init_date + timedelta(days=lowdays)
# High must be before low
assert hdate < ldate

View File

@@ -251,7 +251,7 @@ def test_datahandler__check_empty_df(testdatadir, caplog):
# @pytest.mark.parametrize('datahandler', [])
@pytest.mark.skip("All datahandlers currently support trades data.")
def test_datahandler_trades_not_supported(datahandler, testdatadir, ):
# Currently disabled. Reenable should a new provider not support trades data.
# Currently disabled. Re-enable should a new provider not support trades data.
dh = get_datahandler(testdatadir, datahandler)
with pytest.raises(NotImplementedError):
dh.trades_load('UNITTEST/ETH')

View File

@@ -30,7 +30,7 @@ def test_dp_ohlcv(mocker, default_conf, ohlcv_history, candle_type):
assert dp.ohlcv("UNITTEST/BTC", timeframe, candle_type=candletype) is not ohlcv_history
assert dp.ohlcv("UNITTEST/BTC", timeframe, copy=False, candle_type=candletype) is ohlcv_history
assert not dp.ohlcv("UNITTEST/BTC", timeframe, candle_type=candletype).empty
assert dp.ohlcv("NONESENSE/AAA", timeframe, candle_type=candletype).empty
assert dp.ohlcv("NONSENSE/AAA", timeframe, candle_type=candletype).empty
# Test with and without parameter
assert dp.ohlcv(
@@ -114,7 +114,7 @@ def test_get_pair_dataframe(mocker, default_conf, ohlcv_history, candle_type):
assert dp.get_pair_dataframe("UNITTEST/BTC", timeframe,
candle_type=candle_type) is not ohlcv_history
assert not dp.get_pair_dataframe("UNITTEST/BTC", timeframe, candle_type=candle_type).empty
assert dp.get_pair_dataframe("NONESENSE/AAA", timeframe, candle_type=candle_type).empty
assert dp.get_pair_dataframe("NONSENSE/AAA", timeframe, candle_type=candle_type).empty
# Test with and without parameter
assert dp.get_pair_dataframe("UNITTEST/BTC", timeframe, candle_type=candle_type)\
@@ -125,7 +125,7 @@ def test_get_pair_dataframe(mocker, default_conf, ohlcv_history, candle_type):
assert dp.runmode == RunMode.LIVE
assert isinstance(dp.get_pair_dataframe(
"UNITTEST/BTC", timeframe, candle_type=candle_type), DataFrame)
assert dp.get_pair_dataframe("NONESENSE/AAA", timeframe, candle_type=candle_type).empty
assert dp.get_pair_dataframe("NONSENSE/AAA", timeframe, candle_type=candle_type).empty
historymock = MagicMock(return_value=ohlcv_history)
mocker.patch("freqtrade.data.dataprovider.load_pair_history", historymock)

View File

@@ -3830,7 +3830,7 @@ def test_ohlcv_candle_limit(default_conf, mocker, exchange_name):
[
("BTC/USDT", 'BTC', 'USDT', "binance", True, False, False, 'spot', {}, True),
("USDT/BTC", 'USDT', 'BTC', "binance", True, False, False, 'spot', {}, True),
# No seperating /
# No separating /
("BTCUSDT", 'BTC', 'USDT', "binance", True, False, False, 'spot', {}, True),
("BTCUSDT", None, "USDT", "binance", True, False, False, 'spot', {}, False),
("USDT/BTC", "BTC", None, "binance", True, False, False, 'spot', {}, False),
@@ -4346,7 +4346,7 @@ def test_combine_funding_and_mark(
('binance', 0, 2, "2021-09-01 00:00:01", "2021-09-01 08:00:00", 30.0, -0.00091409999),
('binance', 0, 2, "2021-08-31 23:58:00", "2021-09-01 08:00:00", 30.0, -0.00091409999),
('binance', 0, 2, "2021-09-01 00:10:01", "2021-09-01 08:00:00", 30.0, -0.0002493),
# TODO: Uncoment once _calculate_funding_fees can pas time_in_ratio to exchange._get_funding_fee
# TODO: Uncomment once _calculate_funding_fees can pass time_in_ratio to exchange.
# ('kraken', "2021-09-01 00:00:00", "2021-09-01 08:00:00", 30.0, -0.0014937),
# ('kraken', "2021-09-01 00:00:15", "2021-09-01 08:00:00", 30.0, -0.0008289),
# ('kraken', "2021-09-01 01:00:14", "2021-09-01 08:00:00", 30.0, -0.0008289),
@@ -4358,7 +4358,7 @@ def test_combine_funding_and_mark(
('gate', 0, 2, "2021-09-01 00:00:00", "2021-09-01 12:00:00", 30.0, -0.0009140999),
('gate', 1, 2, "2021-09-01 00:00:01", "2021-09-01 08:00:00", 30.0, -0.0002493),
('binance', 0, 2, "2021-09-01 00:00:00", "2021-09-01 08:00:00", 50.0, -0.0015235),
# TODO: Uncoment once _calculate_funding_fees can pas time_in_ratio to exchange._get_funding_fee
# TODO: Uncomment once _calculate_funding_fees can pass time_in_ratio to exchange.
# ('kraken', "2021-09-01 00:00:00", "2021-09-01 08:00:00", 50.0, -0.0024895),
])
def test__fetch_and_calculate_funding_fees(

View File

@@ -143,7 +143,7 @@ def test_get_timerange_from_backtesting_live_df_pred_not_found(mocker, freqai_co
def test_set_initial_return_values(mocker, freqai_conf):
"""
Simple test of the set initial return values that ensures
we are concatening and ffilling values properly.
we are concatenating and ffilling values properly.
"""
strategy = get_patched_freqai_strategy(mocker, freqai_conf)

View File

@@ -285,7 +285,7 @@ def test_edge_overrides_stoploss(limit_order, fee, caplog, mocker,
'last': enter_price * buy_price_mult,
})
# stoploss shoud be hit
# stoploss should be hit
assert freqtrade.handle_trade(trade) is not ignore_strat_sl
if not ignore_strat_sl:
assert log_has_re('Exit for NEO/BTC detected. Reason: stop_loss.*', caplog)
@@ -1398,7 +1398,7 @@ def test_update_trade_state_sell(
assert order.status == 'open'
freqtrade.update_trade_state(trade, trade.open_orders_ids[-1], l_order)
assert trade.amount == l_order['amount']
# Wallet needs to be updated after closing a limit-sell order to reenable buying
# Wallet needs to be updated after closing a limit-sell order to re-enable buying
assert wallet_mock.call_count == 1
assert not trade.is_open
# Order is updated by update_trade_state
@@ -3240,7 +3240,7 @@ def test_locked_pairs(default_conf_usdt, ticker_usdt, fee,
)
trade.close(ticker_usdt_sell_down()['bid'])
assert freqtrade.strategy.is_pair_locked(trade.pair, side='*')
# Boths sides are locked
# Both sides are locked
assert freqtrade.strategy.is_pair_locked(trade.pair, side='long')
assert freqtrade.strategy.is_pair_locked(trade.pair, side='short')
@@ -4829,7 +4829,7 @@ def test_update_funding_fees(
freqtrade.execute_entry('ETH/USDT', 123, is_short=is_short)
freqtrade.execute_entry('LTC/USDT', 2.0, is_short=is_short)
freqtrade.execute_entry('XRP/USDT', 123, is_short=is_short)
multipl = 1 if is_short else -1
multiple = 1 if is_short else -1
trades = Trade.get_open_trades()
assert len(trades) == 3
for trade in trades:
@@ -4847,7 +4847,7 @@ def test_update_funding_fees(
assert trade.funding_fees == pytest.approx(sum(
trade.amount *
mark_prices[trade.pair].iloc[1:2]['open'] *
funding_rates[trade.pair].iloc[1:2]['open'] * multipl
funding_rates[trade.pair].iloc[1:2]['open'] * multiple
))
else:
@@ -4859,7 +4859,7 @@ def test_update_funding_fees(
trade.amount *
mark_prices[trade.pair].iloc[1:2]['open'] *
funding_rates[trade.pair].iloc[1:2]['open'] *
multipl
multiple
))

View File

@@ -107,7 +107,7 @@ tc5 = BTContainer(data=[
trades=[BTrade(exit_reason=ExitType.ROI, open_tick=1, close_tick=3)]
)
# Test 6: Drops 3% / Recovers 6% Positive / Closes 1% positve, Stop-Loss triggers 2% Loss
# Test 6: Drops 3% / Recovers 6% Positive / Closes 1% positive, Stop-Loss triggers 2% Loss
# stop-loss: 2% ROI: 5%
tc6 = BTContainer(data=[
# D O H L C V EL XL ES Xs BT
@@ -121,7 +121,7 @@ tc6 = BTContainer(data=[
trades=[BTrade(exit_reason=ExitType.STOP_LOSS, open_tick=1, close_tick=2)]
)
# Test 7: 6% Positive / 1% Negative / Close 1% Positve, ROI Triggers 3% Gain
# Test 7: 6% Positive / 1% Negative / Close 1% Positive, ROI Triggers 3% Gain
# stop-loss: 2% ROI: 3%
tc7 = BTContainer(data=[
# D O H L C V EL XL ES Xs BT

View File

@@ -87,9 +87,9 @@ def test_backtest_position_adjustment(default_conf, fee, mocker, testdatadir) ->
for _, t in results.iterrows():
ln = data_pair.loc[data_pair["date"] == t["open_date"]]
# Check open trade rate alignes to open rate
# Check open trade rate aligns to open rate
assert ln is not None
# check close trade rate alignes to close rate or is between high and low
# check close trade rate aligns to close rate or is between high and low
ln = data_pair.loc[data_pair["date"] == t["close_date"]]
assert (round(ln.iloc[0]["open"], 6) == round(t["close_rate"], 6) or
round(ln.iloc[0]["low"], 6) < round(

View File

@@ -152,7 +152,7 @@ def test_lookahead_helper_text_table_lookahead_analysis_instances(lookahead_conf
assert data[0][2].__contains__('too few trades')
assert len(data[0]) == 3
# now check for an error which occured after enough trades
# now check for an error which occurred after enough trades
analysis.total_signals = 12
analysis.false_entry_signals = 11
analysis.false_exit_signals = 10

View File

@@ -129,7 +129,7 @@ def test_generate_backtest_stats(default_conf, testdatadir, tmp_path):
assert strat_stats['backtest_start'] == min_date.strftime(DATETIME_PRINT_FORMAT)
assert strat_stats['backtest_end'] == max_date.strftime(DATETIME_PRINT_FORMAT)
assert strat_stats['total_trades'] == len(results['DefStrat']['results'])
# Above sample had no loosing trade
# Above sample had no losing trade
assert strat_stats['max_drawdown_account'] == 0.0
# Retry with losing trade

View File

@@ -1871,7 +1871,7 @@ def test_get_trades__query(fee, is_short):
# without orders there should be no join issued.
query1 = Trade.get_trades_query([], include_orders=False)
# Empty "with-options -> default - selectin"
# Empty "with-options -> default - selection"
assert query._with_options == ()
assert query1._with_options != ()

View File

@@ -605,7 +605,7 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
"lookback_days": 1}],
"BTC", "binance", "default_refresh_too_short"), # OperationalException expected
# ambigous configuration with lookback days and period
# ambiguous configuration with lookback days and period
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
"lookback_days": 1, "lookback_period": 1}],
"BTC", "binance", "lookback_days_and_period"), # OperationalException expected
@@ -617,7 +617,7 @@ def test_VolumePairList_whitelist_gen(mocker, whitelist_conf, shitcoinmarkets, t
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
"lookback_timeframe": "1m", "lookback_period": 2000, "refresh_period": 3600}],
"BTC", "binance", "lookback_exceeds_exchange_request_size"), # OperationalException expected
# expecing pairs as given
# expecting pairs as given
([{"method": "VolumePairList", "number_assets": 5, "sort_key": "quoteVolume",
"lookback_timeframe": "1d", "lookback_period": 1, "refresh_period": 86400}],
"BTC", "binance", ['LTC/BTC', 'ETH/BTC', 'TKN/BTC', 'XRP/BTC', 'HOT/BTC']),

View File

@@ -1623,7 +1623,7 @@ def test_api_pair_history(botclient, mocker):
assert 'data' in result
data = result['data']
assert len(data) == 289
# analyed DF has 30 columns
# analyzed DF has 30 columns
assert len(result['columns']) == 30
assert len(data[0]) == 30
date_col_idx = [idx for idx, c in enumerate(result['columns']) if c == 'date'][0]

View File

@@ -81,7 +81,7 @@ def test_returns_latest_signal(ohlcv_history):
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
_STRATEGY.config['trading_mode'] = 'futures'
# Short signal get's ignored as can_short is not set.
# Short signal gets ignored as can_short is not set.
assert _STRATEGY.get_entry_signal('ETH/BTC', '5m', mocked_history) == (None, None)
_STRATEGY.can_short = True

View File

@@ -253,7 +253,7 @@ def test_stoploss_from_open(side, profitrange):
assert stoploss >= 0
# Technically the formula can yield values greater than 1 for shorts
# eventhough it doesn't make sense because the position would be liquidated
# even though it doesn't make sense because the position would be liquidated
if side == 'long':
assert stoploss <= 1

View File

@@ -125,7 +125,7 @@ def test_add_areas(default_conf, testdatadir, caplog):
assert fig == fig2
assert log_has_re(r'Indicator "no_indicator" ignored\..*', caplog)
# everythin given in plot config, row 3
# everything given in plot config, row 3
fig3 = add_areas(fig, 3, data, indicators)
figure = fig3.layout.figure
fill_macd = find_trace_in_fig_data(figure.data, "MACD Fill")
@@ -495,7 +495,7 @@ def test_plot_profit(default_conf, mocker, testdatadir):
# no main_plot, adds empty main_plot
([], [], {'subplots': {'RSI': {'rsi': {'color': 'red'}}}},
{'main_plot': {}, 'subplots': {'RSI': {'rsi': {'color': 'red'}}}}),
# indicator 1 / 2 should have prevelance
# indicator 1 / 2 should have prevalence
(['sma', 'ema3'], ['macd'],
{'main_plot': {'sma': {}}, 'subplots': {'RSI': {'rsi': {'color': 'red'}}}},
{'main_plot': {'sma': {}, 'ema3': {}}, 'subplots': {'Other': {'macd': {}}}}