From 9245bb2ce9e86bc276acec6b95ad5d9eea238964 Mon Sep 17 00:00:00 2001 From: GitHub Date: Fri, 3 Jul 2026 15:42:24 +0800 Subject: [PATCH] =?UTF-8?q?chore(tests):=20=E4=BF=AE=E5=A4=8D=20ruff=20UP0?= =?UTF-8?q?38=20(isinstance=20=E5=85=83=E7=BB=84=20->=20int=20|=20float)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_web_backtest.py:556 的 isinstance(x, (int, float)) 触发 ruff UP038。 requires-python>=3.10 支持 PEP 604 的 int | float 运行时语法, 转换安全。 该报错会导致 GitHub Actions CI 失败。 --- tests/unit/test_web_backtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_web_backtest.py b/tests/unit/test_web_backtest.py index 8d69c0b..e16e4ec 100644 --- a/tests/unit/test_web_backtest.py +++ b/tests/unit/test_web_backtest.py @@ -553,7 +553,7 @@ def test_sync_backtest_with_inline_data(client, sample_ohlcv): assert "config" in body # 绩效指标存在且为原生类型 assert "total_return" in body["performance"] - assert isinstance(body["performance"]["total_return"], (int, float)) + assert isinstance(body["performance"]["total_return"], int | float) # 净值曲线有数据 assert len(body["equity_curve"]) > 0