chore(models): 开工前清理 + 去掉 mm1 的残留注释序号

- tests/test_models.py:模块级 pytestmark -> 逐条 @pytest.mark.skip(决策 26);
  该文件的 5 条测试仍然全跳过,只是形式上与其它测试文件对齐了。
- models/metrics.py:rmse / mae / r2_score 的注释 TODO(L0) -> TODO(L1)
  (roadmap 的 L0 12 项里没有这三个指标,它们属于 L1 的 models 清单)。
- simulate.py:用户去掉 # 4. 封装返回 这行残留序号注释(无代码变化)。

校验:pytest 204 passed / 28 skipped;ruff 0;pyright 0
This commit is contained in:
guzhujushi committed 2026-10-10 14:01:56 +08:00
1 parent 9cb295a362
commit 3bb31f95de
3 files changed
+9 -5

No files matched your search

+6 -1
View File
@@ -5,9 +5,10 @@ from __future__ import annotations
import numpy as np
import pytest
pytestmark = pytest.mark.skip(reason="未实现:见 docs/03-roadmap.md L1")
_NOT_IMPLEMENTED = "未实现:见 docs/03-roadmap.md L1"
@pytest.mark.skip(reason=_NOT_IMPLEMENTED)
def test_fit_linear_recovers_known_coefficients(linear_data):
"""真值 y = 2x + 1,拟合系数应在 1% 内。"""
from mcm_toolkit.models import fit_linear
@@ -18,6 +19,7 @@ def test_fit_linear_recovers_known_coefficients(linear_data):
assert np.isclose(r.params["intercept"], 1.0, atol=0.05)
@pytest.mark.skip(reason=_NOT_IMPLEMENTED)
def test_fit_polynomial_matches_numpy(linear_data):
from mcm_toolkit.models import fit_polynomial
@@ -26,6 +28,7 @@ def test_fit_polynomial_matches_numpy(linear_data):
assert np.allclose(r.params["coef"], np.polyfit(x, y, 2), rtol=1e-6)
@pytest.mark.skip(reason=_NOT_IMPLEMENTED)
def test_metrics_known_values():
from mcm_toolkit.models import mae, r2_score, rmse
@@ -36,6 +39,7 @@ def test_metrics_known_values():
assert r2_score(y_true, y_pred) < 1.0
@pytest.mark.skip(reason=_NOT_IMPLEMENTED)
def test_r2_is_one_for_perfect_fit():
from mcm_toolkit.models import r2_score
@@ -43,6 +47,7 @@ def test_r2_is_one_for_perfect_fit():
assert np.isclose(r2_score(y, y), 1.0)
@pytest.mark.skip(reason=_NOT_IMPLEMENTED)
def test_compare_models_returns_table_sorted_by_first_metric(linear_data):
from mcm_toolkit.models import compare_models, fit_linear, fit_polynomial