Skip to content

Commit 5f31753

Browse files
authored
fix(tests): Resolve late binding of loop variable in assert message lambda (#26249)
Signed-off-by: lyd1992 <[email protected]> Signed-off-by: ihb2032 <[email protected]
1 parent 557b2e9 commit 5f31753

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/kernels/mamba/test_mamba_ssm_ssd.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -562,15 +562,15 @@ def test_mamba_chunk_scan_cont_batch_prefill_chunking(chunk_size, seqlens):
562562
Y_ref_seq[: chunked_seqlens[i], ...],
563563
atol=atol,
564564
rtol=rtol,
565-
msg=lambda x: f"seq{i} output part1 " + x,
566-
) # noqa: B023
565+
msg=lambda x, i=i: f"seq{i} output part1 " + x,
566+
)
567567
torch.testing.assert_close(
568568
Y_seq[chunked_seqlens[i] :, ...],
569569
Y_ref_seq[chunked_seqlens[i] :, ...],
570570
atol=atol,
571571
rtol=rtol,
572-
msg=lambda x: f"seq{i} output part2 " + x,
573-
) # noqa: B023
572+
msg=lambda x, i=i: f"seq{i} output part2 " + x,
573+
)
574574

575575
state_seq = state_chunked[i]
576576
state_seq_ref = state_ref[i]
@@ -579,5 +579,5 @@ def test_mamba_chunk_scan_cont_batch_prefill_chunking(chunk_size, seqlens):
579579
state_seq_ref,
580580
atol=atol,
581581
rtol=rtol,
582-
msg=lambda x: f"seq{i} state " + x,
583-
) # noqa: B023
582+
msg=lambda x, i=i: f"seq{i} state " + x,
583+
)

0 commit comments

Comments
 (0)