MCPcopy Create free account
hub / github.com/Lightning-AI/LitServe / test_batch_predict_string_warning

Function test_batch_predict_string_warning

tests/unit/test_batch.py:175–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

173
174
175def test_batch_predict_string_warning():
176 api = ls.test_examples.SimpleBatchedAPI(max_batch_size=2, batch_timeout=0.1)
177 api.request_timeout = 30
178 api.pre_setup(spec=None)
179 api.predict = MagicMock(return_value="This is a string")
180
181 mock_input = torch.tensor([[1.0], [2.0]])
182
183 # Simulate the behavior in run_batched_loop
184 y = api.predict(mock_input)
185 with pytest.warns(
186 UserWarning,
187 match="When batching is enabled, 'predict' must return a list to handle multiple inputs correctly.",
188 ):
189 api.unbatch(y)
190
191
192class FakeResponseQueue:

Callers

nothing calls this directly

Calls 3

predictMethod · 0.95
pre_setupMethod · 0.45
unbatchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…