Skip to content

Commit c7e7808

Browse files
author
劲松
committed
style: 修复 pre-commit 检查失败
- 为 test_opd.py 与 test_agentic_rl_cli_opd.py 补 utf-8 编码声明 - 按仓库锁定的 black 23.3.0(line-length=79)重排两个测试文件 - test_opd.py 增加 redefined-outer-name 豁免(pytest fixture 标准用法)
1 parent 571989c commit c7e7808

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎tests/unit/test_agentic_rl_cli_opd.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""Minimal CLI coverage for teacher_model."""
23

34
from unittest.mock import patch
@@ -16,7 +17,8 @@ def test_run_help_explains_conditional_function_requirements():
1617
assert result.exit_code == 0
1718
assert "--teacher-model" in help_text
1819
assert (
19-
"1. Configuration-driven: Use -c/--config to specify a YAML file" in help_text
20+
"1. Configuration-driven: Use -c/--config to specify a YAML file"
21+
in help_text
2022
)
2123
assert (
2224
"2. Direct parameter: Provide all required arguments via CLI options"

‎tests/unit/test_opd.py‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
# -*- coding: utf-8 -*-
12
"""Minimal OPD contract tests."""
3+
# pylint: disable=redefined-outer-name # pytest fixture 标准用法
24

35
from pathlib import Path
46
from unittest.mock import AsyncMock, MagicMock, patch
@@ -165,7 +167,9 @@ async def test_opd_example_uploads_local_datasets(rl_client):
165167

166168
with patch(
167169
"dashscope.finetune.reinforcement.common.model.to_bailian_data",
168-
new=AsyncMock(side_effect=[["file-train-001"], ["file-validation-001"]]),
170+
new=AsyncMock(
171+
side_effect=[["file-train-001"], ["file-validation-001"]]
172+
),
169173
):
170174
train_ids, validation_ids = await rl_client.upload_datasets()
171175

@@ -186,7 +190,10 @@ def test_regular_rl_example_keeps_resources_and_rl_hyperparameters(rl_client):
186190
assert rl_client.tuning.teacher_model is None
187191
assert rl_client.tuning.training.type == TrainingType.TRAINING_TYPE
188192
assert rl_client.tuning.training.hyper_parameters["algorithm"] == "gspo"
189-
assert rl_client.tuning.training.hyper_parameters["lr_scheduler_type"] == "linear"
193+
assert (
194+
rl_client.tuning.training.hyper_parameters["lr_scheduler_type"]
195+
== "linear"
196+
)
190197
assert rl_client.tuning.training.resources == {
191198
"charge_type": "mtu_postpaid",
192199
"mtu_spec_code": "MTU4",

0 commit comments

Comments
 (0)