From 5f317530ec23444da83cc15c0d3a51c4c2239d5a Mon Sep 17 00:00:00 2001 From: ihb2032 <40718643+ihb2032@users.noreply.github.com> Date: Mon, 6 Oct 2025 00:18:22 +0800 Subject: [PATCH] fix(tests): Resolve late binding of loop variable in assert message lambda (#26249) Signed-off-by: lyd1992 Signed-off-by: ihb2032 <1355790728@qq.com --- tests/kernels/mamba/test_mamba_ssm_ssd.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/kernels/mamba/test_mamba_ssm_ssd.py b/tests/kernels/mamba/test_mamba_ssm_ssd.py index b068ea1ac49c2..57dcb789e97ba 100644 --- a/tests/kernels/mamba/test_mamba_ssm_ssd.py +++ b/tests/kernels/mamba/test_mamba_ssm_ssd.py @@ -562,15 +562,15 @@ def test_mamba_chunk_scan_cont_batch_prefill_chunking(chunk_size, seqlens): Y_ref_seq[: chunked_seqlens[i], ...], atol=atol, rtol=rtol, - msg=lambda x: f"seq{i} output part1 " + x, - ) # noqa: B023 + msg=lambda x, i=i: f"seq{i} output part1 " + x, + ) torch.testing.assert_close( Y_seq[chunked_seqlens[i] :, ...], Y_ref_seq[chunked_seqlens[i] :, ...], atol=atol, rtol=rtol, - msg=lambda x: f"seq{i} output part2 " + x, - ) # noqa: B023 + msg=lambda x, i=i: f"seq{i} output part2 " + x, + ) state_seq = state_chunked[i] state_seq_ref = state_ref[i] @@ -579,5 +579,5 @@ def test_mamba_chunk_scan_cont_batch_prefill_chunking(chunk_size, seqlens): state_seq_ref, atol=atol, rtol=rtol, - msg=lambda x: f"seq{i} state " + x, - ) # noqa: B023 + msg=lambda x, i=i: f"seq{i} state " + x, + )