Use Markdown V1 - update tests

This commit is contained in:
Matthias
2024-02-17 12:02:26 +01:00
parent 4761bf2427
commit 3f3760c0ae
2 changed files with 11 additions and 11 deletions

View File

@@ -1384,12 +1384,12 @@ class Telegram(RPCHandler):
f"({trade['count']})`\n") f"({trade['count']})`\n")
if len(output + stat_line) >= MAX_MESSAGE_LENGTH: if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2) await self._send_msg(output, parse_mode=ParseMode.MARKDOWN)
output = stat_line output = stat_line
else: else:
output += stat_line output += stat_line
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2, await self._send_msg(output, parse_mode=ParseMode.MARKDOWN,
reload_able=True, callback_path="update_enter_tag_performance", reload_able=True, callback_path="update_enter_tag_performance",
query=update.callback_query) query=update.callback_query)
@@ -1410,18 +1410,18 @@ class Telegram(RPCHandler):
output = "*Exit Reason Performance:*\n" output = "*Exit Reason Performance:*\n"
for i, trade in enumerate(trades): for i, trade in enumerate(trades):
stat_line = ( stat_line = (
f"{i + 1}\.\t `{html.escape(trade['exit_reason'])}\t" f"{i + 1}.\t `{trade['exit_reason']}\t"
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} " f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
f"({trade['profit_ratio']:.2%}) " f"({trade['profit_ratio']:.2%}) "
f"({trade['count']})`\n") f"({trade['count']})`\n")
if len(output + stat_line) >= MAX_MESSAGE_LENGTH: if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2) await self._send_msg(output, parse_mode=ParseMode.MARKDOWN)
output = stat_line output = stat_line
else: else:
output += stat_line output += stat_line
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2, await self._send_msg(output, parse_mode=ParseMode.MARKDOWN,
reload_able=True, callback_path="update_exit_reason_performance", reload_able=True, callback_path="update_exit_reason_performance",
query=update.callback_query) query=update.callback_query)
@@ -1442,18 +1442,18 @@ class Telegram(RPCHandler):
output = "*Mix Tag Performance:*\n" output = "*Mix Tag Performance:*\n"
for i, trade in enumerate(trades): for i, trade in enumerate(trades):
stat_line = ( stat_line = (
f"{i + 1}\.\t `{trade['mix_tag']}\t" f"{i + 1}.\t `{trade['mix_tag']}\t"
f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} " f"{fmt_coin(trade['profit_abs'], self._config['stake_currency'])} "
f"({trade['profit_ratio']:.2%}) " f"({trade['profit_ratio']:.2%}) "
f"({trade['count']})`\n") f"({trade['count']})`\n")
if len(output + stat_line) >= MAX_MESSAGE_LENGTH: if len(output + stat_line) >= MAX_MESSAGE_LENGTH:
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2) await self._send_msg(output, parse_mode=ParseMode.MARKDOWN)
output = stat_line output = stat_line
else: else:
output += stat_line output += stat_line
await self._send_msg(output, parse_mode=ParseMode.MARKDOWN_V2, await self._send_msg(output, parse_mode=ParseMode.MARKDOWN,
reload_able=True, callback_path="update_mix_tag_performance", reload_able=True, callback_path="update_mix_tag_performance",
query=update.callback_query) query=update.callback_query)

View File

@@ -1507,7 +1507,7 @@ async def test_telegram_entry_tag_performance_handle(
await telegram._enter_tag_performance(update=update, context=context) await telegram._enter_tag_performance(update=update, context=context)
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1
assert 'Entry Tag Performance' in msg_mock.call_args_list[0][0][0] assert 'Entry Tag Performance' in msg_mock.call_args_list[0][0][0]
assert '<code>TEST1\t3.987 USDT (5.00%) (1)</code>' in msg_mock.call_args_list[0][0][0] assert '`TEST1\t3.987 USDT (5.00%) (1)`' in msg_mock.call_args_list[0][0][0]
context.args = ['XRP/USDT'] context.args = ['XRP/USDT']
await telegram._enter_tag_performance(update=update, context=context) await telegram._enter_tag_performance(update=update, context=context)
@@ -1538,7 +1538,7 @@ async def test_telegram_exit_reason_performance_handle(
await telegram._exit_reason_performance(update=update, context=context) await telegram._exit_reason_performance(update=update, context=context)
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1
assert 'Exit Reason Performance' in msg_mock.call_args_list[0][0][0] assert 'Exit Reason Performance' in msg_mock.call_args_list[0][0][0]
assert '<code>roi\t2.842 USDT (10.00%) (1)</code>' in msg_mock.call_args_list[0][0][0] assert '`roi\t2.842 USDT (10.00%) (1)`' in msg_mock.call_args_list[0][0][0]
context.args = ['XRP/USDT'] context.args = ['XRP/USDT']
await telegram._exit_reason_performance(update=update, context=context) await telegram._exit_reason_performance(update=update, context=context)
@@ -1570,7 +1570,7 @@ async def test_telegram_mix_tag_performance_handle(default_conf_usdt, update, ti
await telegram._mix_tag_performance(update=update, context=context) await telegram._mix_tag_performance(update=update, context=context)
assert msg_mock.call_count == 1 assert msg_mock.call_count == 1
assert 'Mix Tag Performance' in msg_mock.call_args_list[0][0][0] assert 'Mix Tag Performance' in msg_mock.call_args_list[0][0][0]
assert ('<code>TEST3 roi\t2.842 USDT (10.00%) (1)</code>' assert ('`TEST3 roi\t2.842 USDT (10.00%) (1)`'
in msg_mock.call_args_list[0][0][0]) in msg_mock.call_args_list[0][0][0])
context.args = ['XRP/USDT'] context.args = ['XRP/USDT']