From 18469a98f3a661b8d33419be5992f2233203f19f Mon Sep 17 00:00:00 2001
From: log
Date: Thu, 09 Jul 2026 18:32:11 +0800
Subject: [PATCH] fix: avoid eastmoney spot list for akshare updates

---
 tests/test_data_update_v2.py |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/tests/test_data_update_v2.py b/tests/test_data_update_v2.py
index 02e103c..31df51a 100644
--- a/tests/test_data_update_v2.py
+++ b/tests/test_data_update_v2.py
@@ -84,6 +84,29 @@
 
 
 class DataUpdateV2BaoStockTests(unittest.TestCase):
+    def test_fetch_akshare_stock_list_prefers_exchange_code_name_api(self):
+        class FakeAkShare:
+            def stock_info_a_code_name(self):
+                return pd.DataFrame(
+                    [
+                        {"code": "000001", "name": "平安银行"},
+                        {"code": "600519", "name": "贵州茅台"},
+                    ]
+                )
+
+            def stock_zh_a_spot_em(self):
+                raise AssertionError("stock_zh_a_spot_em should not be called")
+
+        result = data_update_v2.fetch_akshare_stock_list(FakeAkShare())
+
+        self.assertEqual(
+            result.to_dict("records"),
+            [
+                {"代码": "000001", "名称": "平安银行"},
+                {"代码": "600519", "名称": "贵州茅台"},
+            ],
+        )
+
     def test_convert_baostock_history_matches_existing_schema(self):
         raw = pd.DataFrame(
             [

--
Gitblit v1.8.0