Fix tests that broke after table formatting changed.

This commit is contained in:
Rokas Kupstys 2021-05-21 12:31:16 +03:00 committed by Matthias
parent 981b2df7ca
commit 25cc4eae96
2 changed files with 25 additions and 29 deletions

View File

@ -508,7 +508,7 @@ def text_table_strategy(strategy_results, stake_currency: str) -> str:
headers = _get_line_header('Strategy', stake_currency) headers = _get_line_header('Strategy', stake_currency)
# _get_line_header() is also used for per-pair summary. Per-pair drawdown is mostly useless # _get_line_header() is also used for per-pair summary. Per-pair drawdown is mostly useless
# therefore we slip this column in only for strategy summary here. # therefore we slip this column in only for strategy summary here.
headers.append(f'Drawdown') headers.append('Drawdown')
# Align drawdown string on the center two space separator. # Align drawdown string on the center two space separator.
drawdown = [f'{t["max_drawdown_per"]:.2f}' for t in strategy_results] drawdown = [f'{t["max_drawdown_per"]:.2f}' for t in strategy_results]

View File

@ -39,14 +39,14 @@ def test_text_table_bt_results():
) )
result_str = ( result_str = (
'| Pair | Buys | Avg Profit % | Cum Profit % | Tot Profit BTC |' '| Pair | Buys | Avg Profit % | Cum Profit % | Tot Profit BTC | Tot Profit % |'
' Tot Profit % | Avg Duration | Wins | Draws | Losses |\n' ' Avg Duration | Win Draw Loss Win% |\n'
'|---------+--------+----------------+----------------+------------------+' '|---------+--------+----------------+----------------+------------------+----------------+'
'----------------+----------------+--------+---------+----------|\n' '----------------+-------------------------|\n'
'| ETH/BTC | 2 | 15.00 | 30.00 | 0.60000000 |' '| ETH/BTC | 2 | 15.00 | 30.00 | 0.60000000 | 15.00 |'
' 15.00 | 0:20:00 | 2 | 0 | 0 |\n' ' 0:20:00 | 2 0 0 100 |\n'
'| TOTAL | 2 | 15.00 | 30.00 | 0.60000000 |' '| TOTAL | 2 | 15.00 | 30.00 | 0.60000000 | 15.00 |'
' 15.00 | 0:20:00 | 2 | 0 | 0 |' ' 0:20:00 | 2 0 0 100 |'
) )
pair_results = generate_pair_metrics(data={'ETH/BTC': {}}, stake_currency='BTC', pair_results = generate_pair_metrics(data={'ETH/BTC': {}}, stake_currency='BTC',
@ -271,14 +271,14 @@ def test_text_table_sell_reason():
) )
result_str = ( result_str = (
'| Sell Reason | Sells | Wins | Draws | Losses |' '| Sell Reason | Sells | Win Draws Loss Win% | Avg Profit % | Cum Profit % |'
' Avg Profit % | Cum Profit % | Tot Profit BTC | Tot Profit % |\n' ' Tot Profit BTC | Tot Profit % |\n'
'|---------------+---------+--------+---------+----------+' '|---------------+---------+--------------------------+----------------+----------------+'
'----------------+----------------+------------------+----------------|\n' '------------------+----------------|\n'
'| roi | 2 | 2 | 0 | 0 |' '| roi | 2 | 2 0 0 100 | 15 | 30 |'
' 15 | 30 | 0.6 | 15 |\n' ' 0.6 | 15 |\n'
'| stop_loss | 1 | 0 | 0 | 1 |' '| stop_loss | 1 | 0 0 1 0 | -10 | -10 |'
' -10 | -10 | -0.2 | -5 |' ' -0.2 | -5 |'
) )
sell_reason_stats = generate_sell_reason_stats(max_open_trades=2, sell_reason_stats = generate_sell_reason_stats(max_open_trades=2,
@ -356,18 +356,14 @@ def test_text_table_strategy(default_conf):
), 'config': default_conf} ), 'config': default_conf}
result_str = ( result_str = (
'| Strategy | Buys | Avg Profit % | Cum Profit % | Tot Profit BTC ' '| Strategy | Buys | Avg Profit % | Cum Profit % | Tot Profit BTC |'
'| Tot Profit % | Avg Duration | Wins | Draws | Losses | Drawdown BTC ' ' Tot Profit % | Avg Duration | Win Draw Loss Win% | Drawdown |\n'
'| Drawdown % |\n' '|---------------+--------+----------------+----------------+------------------+'
'|---------------+--------+----------------+----------------+------------------' '----------------+----------------+-------------------------+-----------------------|\n'
'+----------------+----------------+--------+---------+----------+----------------' '| TestStrategy1 | 3 | 20.00 | 60.00 | 1.10000000 |'
'+--------------|\n' ' 36.67 | 0:17:00 | 3 0 0 100 | 0.00000000 BTC 0.00% |\n'
'| TestStrategy1 | 3 | 20.00 | 60.00 | 1.10000000 ' '| TestStrategy2 | 3 | 30.00 | 90.00 | 1.30000000 |'
'| 36.67 | 0:17:00 | 3 | 0 | 0 | 0 ' ' 43.33 | 0:20:00 | 3 0 0 100 | 0.00000000 BTC 0.00% |'
'| 0 |\n'
'| TestStrategy2 | 3 | 30.00 | 90.00 | 1.30000000 '
'| 43.33 | 0:20:00 | 3 | 0 | 0 | 0 '
'| 0 |'
) )
strategy_results = generate_strategy_comparison(all_results=results) strategy_results = generate_strategy_comparison(all_results=results)