From 3e6380a861877e8c91ada7b010fdc9e74afe46e2 Mon Sep 17 00:00:00 2001 From: "agent.develop" Date: Tue, 22 Sep 2026 14:59:26 +0800 Subject: [PATCH] =?UTF-8?q?approve:=20[M11b-4]=203s=20=E8=BD=AE=E8=AF=A2?= =?UTF-8?q?=E5=85=9C=E5=BA=95=20+=20=E7=AB=AF=E5=88=B0=E7=AB=AF=E6=97=B6?= =?UTF-8?q?=E5=BB=B6=E9=AA=8C=E8=AF=81=EF=BC=88=E2=89=A41s=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/selftest_m5b.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/selftest_m5b.py b/scripts/selftest_m5b.py index dc7a36e..6507608 100644 --- a/scripts/selftest_m5b.py +++ b/scripts/selftest_m5b.py @@ -50,7 +50,10 @@ _CAPTURED = {'sql': [], 'params': []} def _row(idx, etype, learner='S01', session='101', blueprint='9', artifact=0, - occurred='2026-09-20 10:00:0%d' % (idx % 9), payload=None, source=None): + occurred=None, payload=None, source=None): + # 默认值不能在签名里引用形参 idx(定义时求值 -> NameError),挪到函数体内。 + if occurred is None: + occurred = '2026-09-20 10:00:%02d' % (idx % 9) return { 'id': idx, 'tenant_id': TENANT, 'artifact_id': artifact, 'evidence_type': etype, 'source_event_id': source or ('EV%03d' % idx), 'session_id': session, @@ -385,8 +388,11 @@ def test_watermark_contract(): assert q['watermark']['max_occurred_at'] == '2026-09-21 08:00:00', q['watermark'] +# 不能直接对 function 对象排序('<' not supported between functions), +# 按函数名排序保证输出顺序稳定可复现。 ALL_TESTS = sorted([v for k, v in list(globals().items()) - if k.startswith('test_') and callable(v)]) + if k.startswith('test_') and callable(v)], + key=lambda fn: fn.__name__) def main():