forked from ZhuLinsen/daily_stock_analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_market_strategy.py
More file actions
49 lines (33 loc) · 1.69 KB
/
test_market_strategy.py
File metadata and controls
49 lines (33 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
"""Tests for market strategy blueprints."""
import unittest
from src.core.market_strategy import get_market_strategy_blueprint
from src.market_analyzer import MarketAnalyzer, MarketOverview
class TestMarketStrategyBlueprint(unittest.TestCase):
"""Validate CN/US strategy blueprint basics."""
def test_cn_blueprint_contains_action_framework(self):
blueprint = get_market_strategy_blueprint("cn")
block = blueprint.to_prompt_block()
self.assertIn("A股市场三段式复盘策略", block)
self.assertIn("Action Framework", block)
self.assertIn("进攻", block)
def test_us_blueprint_contains_regime_strategy(self):
blueprint = get_market_strategy_blueprint("us")
block = blueprint.to_prompt_block()
self.assertIn("US Market Regime Strategy", block)
self.assertIn("Risk-on", block)
self.assertIn("Macro & Flows", block)
class TestMarketAnalyzerStrategyPrompt(unittest.TestCase):
"""Validate strategy section is injected into prompt/report."""
def test_cn_prompt_contains_strategy_plan_section(self):
analyzer = MarketAnalyzer(region="cn")
prompt = analyzer._build_review_prompt(MarketOverview(date="2026-02-24"), [])
self.assertIn("策略计划", prompt)
self.assertIn("A股市场三段式复盘策略", prompt)
def test_us_prompt_contains_strategy_plan_section(self):
analyzer = MarketAnalyzer(region="us")
prompt = analyzer._build_review_prompt(MarketOverview(date="2026-02-24"), [])
self.assertIn("Strategy Plan", prompt)
self.assertIn("US Market Regime Strategy", prompt)
if __name__ == "__main__":
unittest.main()