Tests should also use CandleType

This commit is contained in:
Matthias 2021-12-03 14:27:04 +01:00
parent 2f17fa2765
commit d30aaaeaaa
3 changed files with 7 additions and 7 deletions

View File

@ -16,5 +16,5 @@ class CandleType(str, Enum):
def from_string(cls, value: str) -> 'CandleType':
if not value:
# Default to spot
return CandleType.SPOT
return CandleType.SPOT_
return CandleType(value)

View File

@ -11,7 +11,7 @@ import ccxt
import pytest
from pandas import DataFrame
from freqtrade.enums import Collateral, TradingMode
from freqtrade.enums import CandleType, Collateral, TradingMode
from freqtrade.exceptions import (DDosProtection, DependencyException, InvalidOrderException,
OperationalException, PricingError, TemporaryError)
from freqtrade.exchange import Binance, Bittrex, Exchange, Kraken
@ -1685,7 +1685,7 @@ async def test__async_get_historic_ohlcv(default_conf, mocker, caplog, exchange_
pair = 'ETH/USDT'
respair, restf, _, res = await exchange._async_get_historic_ohlcv(
pair, "5m", 1500000000000, is_new_pair=False)
pair, "5m", 1500000000000, candle_type=CandleType.SPOT, is_new_pair=False)
assert respair == pair
assert restf == '5m'
# Call with very old timestamp - causes tons of requests

View File

@ -11,7 +11,7 @@ import arrow
import pytest
from freqtrade.constants import CANCEL_REASON, MATH_CLOSE_PREC, UNLIMITED_STAKE_AMOUNT
from freqtrade.enums import RPCMessageType, RunMode, SellType, SignalDirection, State
from freqtrade.enums import CandleType, RPCMessageType, RunMode, SellType, SignalDirection, State
from freqtrade.exceptions import (DependencyException, ExchangeError, InsufficientFundsError,
InvalidOrderException, OperationalException, PricingError,
TemporaryError)
@ -696,9 +696,9 @@ def test_process_informative_pairs_added(default_conf_usdt, ticker_usdt, mocker)
freqtrade.process()
assert inf_pairs.call_count == 1
assert refresh_mock.call_count == 1
assert ("BTC/ETH", "1m", '') in refresh_mock.call_args[0][0]
assert ("ETH/USDT", "1h", '') in refresh_mock.call_args[0][0]
assert ("ETH/USDT", default_conf_usdt["timeframe"], '') in refresh_mock.call_args[0][0]
assert ("BTC/ETH", "1m", CandleType.SPOT_) in refresh_mock.call_args[0][0]
assert ("ETH/USDT", "1h", CandleType.SPOT_) in refresh_mock.call_args[0][0]
assert ("ETH/USDT", default_conf_usdt["timeframe"], CandleType.SPOT) in refresh_mock.call_args[0][0]
@pytest.mark.parametrize("trading_mode", [