Skip to content

Commit

Permalink
Add tests for market_is_pair()
Browse files Browse the repository at this point in the history
  • Loading branch information
hroff-1902 committed Oct 17, 2019
1 parent 66605a1 commit e8eb968
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/exchange/test_exchange.py
Expand Up @@ -18,7 +18,8 @@
timeframe_to_msecs,
timeframe_to_next_date,
timeframe_to_prev_date,
timeframe_to_seconds)
timeframe_to_seconds,
market_is_pair)
from freqtrade.resolvers.exchange_resolver import ExchangeResolver
from tests.conftest import get_patched_exchange, log_has, log_has_re

Expand Down Expand Up @@ -1555,3 +1556,24 @@ def test_timeframe_to_next_date():

date = datetime.now(tz=timezone.utc)
assert timeframe_to_next_date("5m") > date


@pytest.mark.parametrize("market,base_currency,quote_currency,expected_result", [
({'symbol': "BTC/USDT"}, None, None, True),
({'symbol': "USDT/BTC"}, None, None, True),
({'symbol': "BTCUSDT"}, None, None, False),
({'symbol': "BTC/USDT"}, None, "USDT", True),
({'symbol': "USDT/BTC"}, None, "USDT", False),
({'symbol': "BTCUSDT"}, None, "USDT", False),
({'symbol': "BTC/USDT"}, "BTC", None, True),
({'symbol': "USDT/BTC"}, "BTC", None, False),
({'symbol': "BTCUSDT"}, "BTC", None, False),
({'symbol': "BTC/USDT"}, "BTC", "USDT", True),
({'symbol': "BTC/USDT"}, "USDT", "BTC", False),
({'symbol': "BTC/USDT"}, "BTC", "USD", False),
({'symbol': "BTCUSDT"}, "BTC", "USDT", False),
({'symbol': "BTC/"}, None, None, False),
({'symbol': "/USDT"}, None, None, False),
])
def test_market_is_pair(market, base_currency, quote_currency, expected_result) -> None:
assert market_is_pair(market, base_currency, quote_currency) == expected_result

0 comments on commit e8eb968

Please sign in to comment.