remove numbers from test method names
This commit is contained in:
parent
9cca42e371
commit
616d5b61cc
@ -23,23 +23,23 @@ RESULT_BITTREX = {
|
|||||||
def result():
|
def result():
|
||||||
return parse_ticker_dataframe(RESULT_BITTREX['result'], arrow.get('2017-08-30T10:00:00'))
|
return parse_ticker_dataframe(RESULT_BITTREX['result'], arrow.get('2017-08-30T10:00:00'))
|
||||||
|
|
||||||
def test_1_dataframe_has_correct_columns(result):
|
def test_dataframe_has_correct_columns(result):
|
||||||
assert result.columns.tolist() == \
|
assert result.columns.tolist() == \
|
||||||
['close', 'high', 'low', 'open', 'date', 'volume']
|
['close', 'high', 'low', 'open', 'date', 'volume']
|
||||||
|
|
||||||
def test_2_orders_by_date(result):
|
def test_orders_by_date(result):
|
||||||
assert result['date'].tolist() == \
|
assert result['date'].tolist() == \
|
||||||
['2017-08-30T10:34:00',
|
['2017-08-30T10:34:00',
|
||||||
'2017-08-30T10:37:00',
|
'2017-08-30T10:37:00',
|
||||||
'2017-08-30T10:40:00',
|
'2017-08-30T10:40:00',
|
||||||
'2017-08-30T10:42:00']
|
'2017-08-30T10:42:00']
|
||||||
|
|
||||||
def test_3_populates_buy_trend(result):
|
def test_populates_buy_trend(result):
|
||||||
dataframe = populate_buy_trend(populate_indicators(result))
|
dataframe = populate_buy_trend(populate_indicators(result))
|
||||||
assert 'buy' in dataframe.columns
|
assert 'buy' in dataframe.columns
|
||||||
assert 'buy_price' in dataframe.columns
|
assert 'buy_price' in dataframe.columns
|
||||||
|
|
||||||
def test_4_returns_latest_buy_signal():
|
def test_returns_latest_buy_signal():
|
||||||
buydf = DataFrame([{'buy': 1, 'date': arrow.utcnow()}])
|
buydf = DataFrame([{'buy': 1, 'date': arrow.utcnow()}])
|
||||||
with patch('freqtrade.analyze.analyze_ticker', return_value=buydf):
|
with patch('freqtrade.analyze.analyze_ticker', return_value=buydf):
|
||||||
assert get_buy_signal('BTC-ETH') == True
|
assert get_buy_signal('BTC-ETH') == True
|
||||||
|
@ -46,7 +46,7 @@ def conf():
|
|||||||
validate(configuration, CONF_SCHEMA)
|
validate(configuration, CONF_SCHEMA)
|
||||||
return configuration
|
return configuration
|
||||||
|
|
||||||
def test_1_create_trade(conf):
|
def test_create_trade(conf):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True) as buy_signal:
|
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True) as buy_signal:
|
||||||
with patch.multiple('freqtrade.main.telegram', init=MagicMock(), send_msg=MagicMock()):
|
with patch.multiple('freqtrade.main.telegram', init=MagicMock(), send_msg=MagicMock()):
|
||||||
@ -79,7 +79,7 @@ def test_1_create_trade(conf):
|
|||||||
[call('BTC_ETH'), call('BTC_TKN'), call('BTC_TRST'), call('BTC_SWT')]
|
[call('BTC_ETH'), call('BTC_TKN'), call('BTC_TRST'), call('BTC_SWT')]
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_2_handle_trade(conf):
|
def test_handle_trade(conf):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
with patch.multiple('freqtrade.main.telegram', init=MagicMock(), send_msg=MagicMock()):
|
with patch.multiple('freqtrade.main.telegram', init=MagicMock(), send_msg=MagicMock()):
|
||||||
with patch.multiple('freqtrade.main.exchange',
|
with patch.multiple('freqtrade.main.exchange',
|
||||||
@ -97,7 +97,7 @@ def test_2_handle_trade(conf):
|
|||||||
assert trade.close_date is not None
|
assert trade.close_date is not None
|
||||||
assert trade.open_order_id == 'dry_run'
|
assert trade.open_order_id == 'dry_run'
|
||||||
|
|
||||||
def test_3_close_trade(conf):
|
def test_close_trade(conf):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
trade = Trade.query.filter(Trade.is_open.is_(True)).first()
|
trade = Trade.query.filter(Trade.is_open.is_(True)).first()
|
||||||
assert trade
|
assert trade
|
||||||
|
@ -4,7 +4,7 @@ from freqtrade.exchange import Exchange
|
|||||||
from freqtrade.persistence import Trade
|
from freqtrade.persistence import Trade
|
||||||
|
|
||||||
|
|
||||||
def test_1_exec_sell_order():
|
def test_exec_sell_order():
|
||||||
with patch('freqtrade.main.exchange.sell', side_effect='mocked_order_id') as api_mock:
|
with patch('freqtrade.main.exchange.sell', side_effect='mocked_order_id') as api_mock:
|
||||||
trade = Trade(
|
trade = Trade(
|
||||||
pair='BTC_ETH',
|
pair='BTC_ETH',
|
||||||
|
@ -56,7 +56,7 @@ class MagicBot(MagicMock, Bot):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def test_1_status_handle(conf, update):
|
def test_status_handle(conf, update):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True):
|
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True):
|
||||||
msg_mock = MagicMock()
|
msg_mock = MagicMock()
|
||||||
@ -80,7 +80,7 @@ def test_1_status_handle(conf, update):
|
|||||||
assert msg_mock.call_count == 2
|
assert msg_mock.call_count == 2
|
||||||
assert '[BTC_ETH]' in msg_mock.call_args_list[-1][0][0]
|
assert '[BTC_ETH]' in msg_mock.call_args_list[-1][0][0]
|
||||||
|
|
||||||
def test_2_profit_handle(conf, update):
|
def test_profit_handle(conf, update):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True):
|
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True):
|
||||||
msg_mock = MagicMock()
|
msg_mock = MagicMock()
|
||||||
@ -109,7 +109,7 @@ def test_2_profit_handle(conf, update):
|
|||||||
assert msg_mock.call_count == 2
|
assert msg_mock.call_count == 2
|
||||||
assert '(100.00%)' in msg_mock.call_args_list[-1][0][0]
|
assert '(100.00%)' in msg_mock.call_args_list[-1][0][0]
|
||||||
|
|
||||||
def test_3_forcesell_handle(conf, update):
|
def test_forcesell_handle(conf, update):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True):
|
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True):
|
||||||
msg_mock = MagicMock()
|
msg_mock = MagicMock()
|
||||||
@ -136,7 +136,7 @@ def test_3_forcesell_handle(conf, update):
|
|||||||
assert 'Selling [BTC/ETH]' in msg_mock.call_args_list[-1][0][0]
|
assert 'Selling [BTC/ETH]' in msg_mock.call_args_list[-1][0][0]
|
||||||
assert '0.072561' in msg_mock.call_args_list[-1][0][0]
|
assert '0.072561' in msg_mock.call_args_list[-1][0][0]
|
||||||
|
|
||||||
def test_4_performance_handle(conf, update):
|
def test_performance_handle(conf, update):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True):
|
with patch('freqtrade.main.get_buy_signal', side_effect=lambda _: True):
|
||||||
msg_mock = MagicMock()
|
msg_mock = MagicMock()
|
||||||
@ -166,7 +166,7 @@ def test_4_performance_handle(conf, update):
|
|||||||
assert 'Performance' in msg_mock.call_args_list[-1][0][0]
|
assert 'Performance' in msg_mock.call_args_list[-1][0][0]
|
||||||
assert 'BTC_ETH 100.00%' in msg_mock.call_args_list[-1][0][0]
|
assert 'BTC_ETH 100.00%' in msg_mock.call_args_list[-1][0][0]
|
||||||
|
|
||||||
def test_5_start_handle(conf, update):
|
def test_start_handle(conf, update):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
msg_mock = MagicMock()
|
msg_mock = MagicMock()
|
||||||
with patch.multiple('freqtrade.main.telegram', _CONF=conf, init=MagicMock(), send_msg=msg_mock):
|
with patch.multiple('freqtrade.main.telegram', _CONF=conf, init=MagicMock(), send_msg=msg_mock):
|
||||||
@ -178,7 +178,7 @@ def test_5_start_handle(conf, update):
|
|||||||
assert get_state() == State.RUNNING
|
assert get_state() == State.RUNNING
|
||||||
assert msg_mock.call_count == 0
|
assert msg_mock.call_count == 0
|
||||||
|
|
||||||
def test_6_stop_handle(conf, update):
|
def test_stop_handle(conf, update):
|
||||||
with patch.dict('freqtrade.main._CONF', conf):
|
with patch.dict('freqtrade.main._CONF', conf):
|
||||||
msg_mock = MagicMock()
|
msg_mock = MagicMock()
|
||||||
with patch.multiple('freqtrade.main.telegram', _CONF=conf, init=MagicMock(), send_msg=msg_mock):
|
with patch.multiple('freqtrade.main.telegram', _CONF=conf, init=MagicMock(), send_msg=msg_mock):
|
||||||
@ -190,4 +190,3 @@ def test_6_stop_handle(conf, update):
|
|||||||
assert get_state() == State.STOPPED
|
assert get_state() == State.STOPPED
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert 'Stopping trader' in msg_mock.call_args_list[0][0][0]
|
assert 'Stopping trader' in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user