Skip to content

Commit c87c154

Browse files
test: verify output_kind override to FINAL_ONLY
Add test to ensure Generator always overrides output_kind to FINAL_ONLY when initialized with custom sampling_params dict, protecting against accidental removal of this system requirement.
1 parent 5620d8e commit c87c154

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/unit_tests/test_generator_config.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,26 @@ def test_generator_yaml_config_loading(self):
132132
self.assertEqual(generator.sampling_params.n, 2)
133133
self.assertEqual(generator.sampling_params.max_tokens, 32)
134134

135+
@pytest.mark.skipif(
136+
_import_error(),
137+
reason="Import error, likely due to missing dependencies on CI.",
138+
)
139+
def test_generator_overrides_output_kind_to_final_only(self):
140+
"""Generator overrides output_kind to FINAL_ONLY when initialized with dict."""
141+
from forge.actors.generator import Generator
142+
from vllm.sampling_params import RequestOutputKind
143+
144+
sampling_dict = {
145+
"n": 1,
146+
"max_tokens": 16,
147+
"output_kind": RequestOutputKind.DELTA,
148+
}
149+
150+
generator = Generator(sampling_params=sampling_dict)
151+
self.assertEqual(
152+
generator.sampling_params.output_kind, RequestOutputKind.FINAL_ONLY
153+
)
154+
135155

136156
if __name__ == "__main__":
137157
unittest.main()

0 commit comments

Comments
 (0)