| | |
| | | ], |
| | | ) |
| | | |
| | | def test_parse_n_stocks_supports_all(self): |
| | | self.assertIsNone(data_update_v2.parse_n_stocks("all")) |
| | | self.assertIsNone(data_update_v2.parse_n_stocks("全部")) |
| | | self.assertEqual(data_update_v2.parse_n_stocks("6000"), 6000) |
| | | |
| | | def test_fetch_stock_list_from_akshare_all_keeps_full_list(self): |
| | | stock_list = pd.DataFrame( |
| | | [{"代码": f"{index:06d}", "名称": f"测试{index}"} for index in range(10)] |
| | | ) |
| | | |
| | | with patch.object( |
| | | data_update_v2, |
| | | "fetch_akshare_stock_list", |
| | | return_value=stock_list, |
| | | ): |
| | | with patch.dict(sys.modules, {"akshare": object()}): |
| | | result = data_update_v2.fetch_stock_list_from_akshare(n_stocks=None) |
| | | |
| | | self.assertEqual(len(result), 10) |
| | | |
| | | def test_akshare_history_failures_abort_before_full_stock_pool(self): |
| | | class FakeAkShare: |
| | | def __init__(self): |