1b51f73ecd
Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""AI 复盘 journal 文本格式化(四所共用)。"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from ai_review_lib import journal_row_lines_for_ai # noqa: E402
|
|
|
|
|
|
class TestAiReviewLib(unittest.TestCase):
|
|
def test_journal_row_includes_expect_and_actual_rr(self):
|
|
text = journal_row_lines_for_ai(
|
|
1,
|
|
{
|
|
"coin": "HYPE",
|
|
"tf": "5m",
|
|
"pnl": "10.73",
|
|
"real_rr": "2.1354",
|
|
"expect_rr": "-",
|
|
"entry_reason": "趋势回调",
|
|
"exit_reason": "移动止盈",
|
|
"hold_duration": "1天 3小时",
|
|
"mood_issues": "",
|
|
"post_breakeven_stare": "否",
|
|
"new_trade_while_occupied": "否",
|
|
"note": "测试备注",
|
|
},
|
|
)
|
|
self.assertIn("实际RR:2.1354", text)
|
|
self.assertIn("预期RR:-", text)
|
|
self.assertIn("开仓逻辑:趋势回调", text)
|
|
self.assertIn("备注:测试备注", text)
|
|
self.assertNotIn("开仓类型", text)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|