# tests 目录 针对纯函数(不依赖网络、数据库、BaoStock 登录)的单元测试。 ## 运行 ```bash pip install -e .[dev] # 或 pip install pytest pytest -v ``` ## 覆盖范围(43 个用例) - `test_code_mapping.py` —— `baostock_conn.code_to_bs` 代码前缀映射(5) - `test_daily_derived.py` —— `daily._fill_derived_fields` 振幅/涨跌幅补算(5) - `test_daily_source_codes.py` —— sina/tencent/eastmoney 各源代码前缀映射(8) - `test_daily_sources_http.py` —— 腾讯/东财 HTTP JSON 解析(mock requests,8) - `test_financial_quarters.py` —— `financial._recent_quarters` 季度滚动(5) - `test_log.py` —— `log.get_logger` 命名空间、handler 幂等、env 控制 level(5) - `test_market_classification.py` —— `market_daily._is_20pct` 板块判定(4) - `test_sector_merge.py` —— `sector.fetch_sector` 三种 only 模式合并保护(3)