Skip to content

Commit a86ef02

Browse files
suan babyclaude
andcommitted
test: update board tests for US/HK market support
Update test to reflect new behavior where US and HK markets can now fetch sector/board data. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent efbc6db commit a86ef02

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

tests/test_pipeline_related_boards.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,30 @@ def test_attach_belong_boards_copies_existing_board_list(self) -> None:
4747
pipeline.fetcher_manager.get_belong_boards.assert_not_called()
4848

4949
def test_attach_belong_boards_skips_provider_for_non_cn(self) -> None:
50+
"""For HK market (non-CN), should attempt to fetch board data."""
5051
pipeline = StockAnalysisPipeline.__new__(StockAnalysisPipeline)
5152
pipeline.fetcher_manager = MagicMock()
53+
pipeline.fetcher_manager.get_belong_boards.return_value = [{"name": "科技", "type": "行业"}]
5254

53-
context = {"market": "us", "status": "not_supported"}
55+
context = {"market": "hk", "status": "not_supported"}
56+
enriched = pipeline._attach_belong_boards_to_fundamental_context("00700", context)
57+
58+
# HK market now supports board data fetch
59+
self.assertEqual(enriched["belong_boards"], [{"name": "科技", "type": "行业"}])
60+
pipeline.fetcher_manager.get_belong_boards.assert_called_once_with("00700")
61+
62+
def test_attach_belong_boards_allows_us_market(self) -> None:
63+
"""US market should also be able to fetch board data."""
64+
pipeline = StockAnalysisPipeline.__new__(StockAnalysisPipeline)
65+
pipeline.fetcher_manager = MagicMock()
66+
pipeline.fetcher_manager.get_belong_boards.return_value = [{"name": "Tech", "type": "Sector"}]
67+
68+
context = {"market": "us", "status": "ok"}
5469
enriched = pipeline._attach_belong_boards_to_fundamental_context("AAPL", context)
5570

56-
self.assertEqual(enriched["belong_boards"], [])
57-
pipeline.fetcher_manager.get_belong_boards.assert_not_called()
71+
# US market now supports board data fetch
72+
self.assertEqual(enriched["belong_boards"], [{"name": "Tech", "type": "Sector"}])
73+
pipeline.fetcher_manager.get_belong_boards.assert_called_once_with("AAPL")
5874

5975
def test_attach_belong_boards_skips_provider_when_board_block_not_supported(self) -> None:
6076
pipeline = StockAnalysisPipeline.__new__(StockAnalysisPipeline)

0 commit comments

Comments
 (0)