mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Improve exception wording
This commit is contained in:
parent
9e6cc5ebbd
commit
74709461e3
|
@ -7,6 +7,7 @@ from freqtrade.constants import DATETIME_PRINT_FORMAT, DEFAULT_TRADES_COLUMNS, C
|
|||
from freqtrade.data.converter.trade_converter import (trades_convert_types,
|
||||
trades_df_remove_duplicates)
|
||||
from freqtrade.data.history.idatahandler import get_datahandler
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.resolvers import ExchangeResolver
|
||||
|
||||
|
||||
|
@ -20,7 +21,7 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str):
|
|||
Import kraken trades from csv
|
||||
"""
|
||||
if config['exchange']['name'] != 'kraken':
|
||||
raise ValueError('This function is only for kraken exchange')
|
||||
raise OperationalException('This function is only for the kraken exchange.')
|
||||
|
||||
datadir: Path = config['datadir']
|
||||
data_handler = get_datahandler(datadir, data_format=convert_to)
|
||||
|
|
|
@ -3,12 +3,18 @@ from pathlib import Path
|
|||
from shutil import copytree
|
||||
from unittest.mock import PropertyMock
|
||||
|
||||
import pytest
|
||||
|
||||
from freqtrade.data.converter.trade_converter_kraken import import_kraken_trades_from_csv
|
||||
from freqtrade.data.history.idatahandler import get_datahandler
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from tests.conftest import EXMS, log_has, log_has_re, patch_exchange
|
||||
|
||||
|
||||
def test_import_kraken_trades_from_csv(testdatadir, tmpdir, caplog, default_conf_usdt, mocker):
|
||||
with pytest.raises(OperationalException, match="This function is only for the kraken exchange"):
|
||||
import_kraken_trades_from_csv(default_conf_usdt, 'feather')
|
||||
|
||||
default_conf_usdt['exchange']['name'] = 'kraken'
|
||||
|
||||
patch_exchange(mocker, id='kraken')
|
||||
|
|
Loading…
Reference in New Issue
Block a user