Skip to content

Commit c22afdc

Browse files
committed
Code coverage
1 parent e39596e commit c22afdc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_beam.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,19 @@ def test_invalid_prune_threshold():
9090
BeamParams(K=1, prune_threshold=-0.1)
9191

9292

93+
def test_beam_params_eos_tokens_deprecation():
94+
"""Test that the deprecated eos_tokens kwarg works and warns."""
95+
with pytest.warns(DeprecationWarning, match="eos_tokens.*deprecated"):
96+
params = BeamParams(K=3, eos_tokens=[b".", b"!"])
97+
assert params.eos_byte_strings == {b".", b"!"}
98+
99+
100+
def test_beam_params_eos_tokens_and_byte_strings_conflict():
101+
"""Test that specifying both eos_tokens and eos_byte_strings raises."""
102+
with pytest.raises(TypeError, match="Cannot specify both"):
103+
BeamParams(K=3, eos_byte_strings=[b"."], eos_tokens=[b"!"])
104+
105+
93106
# EOS-specific tests
94107
@pytest.mark.asyncio
95108
async def test_eos_manual_configuration(llm):

0 commit comments

Comments
 (0)