main
py 20 lines 568 Bytes
Raw
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
4 from vllm.v1.structured_output.utils import strip_speculative_padding
5
6
7 def test_strips_trailing_padding():
8 assert strip_speculative_padding([3, 4, -1, -1]) == [3, 4]
9
10
11 def test_empty_when_leading_padding():
12 assert strip_speculative_padding([-1, -1]) == []
13
14
15 def test_passthrough_without_padding():
16 assert strip_speculative_padding([3, 4]) == [3, 4]
17
18
19 def test_truncates_at_first_sentinel():
20 assert strip_speculative_padding([3, -1, 4]) == [3]