log
2026-07-09 048ea1585b4e1b89ef1f547844869ef9a74accd8
tests/test_data_update_v2.py
@@ -107,6 +107,35 @@
            ],
        )
    def test_akshare_history_failures_abort_before_full_stock_pool(self):
        class FakeAkShare:
            def __init__(self):
                self.history_calls = 0
            def stock_info_a_code_name(self):
                return pd.DataFrame(
                    [
                        {"code": f"{index:06d}", "name": f"测试{index}"}
                        for index in range(1, 21)
                    ]
                )
            def stock_zh_a_hist(self, **kwargs):
                self.history_calls += 1
                raise ConnectionError(
                    "Remote end closed connection without response"
                )
        fake_ak = FakeAkShare()
        with patch.dict(sys.modules, {"akshare": fake_ak}):
            result = data_update_v2.fetch_real_stock_data_from_akshare_only(
                n_stocks=20, days=10, max_consecutive_failures=3
            )
        self.assertIsNone(result)
        self.assertEqual(fake_ak.history_calls, 3)
    def test_convert_baostock_history_matches_existing_schema(self):
        raw = pd.DataFrame(
            [