[python] Add type hints to the tree updater tests #12913
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 192 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.315
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #12913"
general
weight: 0.35
trivialfis
This PR addresses part of issue #6496.
Part of #6496, following the same pattern as #12838, #12901 and #12905.
This PR adds
tests/python/test_updaters.pyto the list of files checked by mypy in CI(
ops/script/type_check_python.py).Changes needed for the file to pass mypy (
disallow_untyped_defsis enabled):test_exact(param: Dict[str, Any],num_rounds: int,dataset: tm.TestDataset),test_pruner,test_hist_categorical,test_hist_degenerate_caseandtest_sparse.test_hist_categoricalasTrainingCallback.EvalsLog.The test logic, expected values and assertions are unchanged.
Most of the other untyped files in
tests/python/(test_basic.py,test_basic_models.py,test_callback.py,test_dmatrix.py,test_parse_tree.py,test_predict.py,test_ranking.py,test_survival.py,test_with_arrow.py,test_with_pandas.py,test_with_sklearn.py) are touched by open PRs at the moment, so I leftthem out to avoid conflicts with those PRs.
Verified locally (Python 3.12, mypy 2.4.1, ruff 0.16.6):
cd python-package && mypy ../tests/python/test_updaters.py ../ops/script/type_check_python.py
# Success on this branch; master reports 5 errors for test_updaters.py
pytest tests/python/test_updaters.py
# 33 passed (same count as master), against a libxgboost built from master
ruff checkandruff format --check(pre-commit config) pass on the changed files.