Skip to content

Commit 0781920

Browse files
committed
add unit test
1 parent 41802c5 commit 0781920

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/server/tests/unit/test_chat_completion.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ def test_chat_completion_with_timings_per_token():
271271
"max_tokens": 10,
272272
"messages": [{"role": "user", "content": "test"}],
273273
"stream": True,
274+
"stream_options": {"include_usage": True},
274275
"timings_per_token": True,
275276
})
277+
stats_received = False
276278
for i, data in enumerate(res):
277279
if i == 0:
278280
# Check first role message for stream=True
@@ -288,6 +290,8 @@ def test_chat_completion_with_timings_per_token():
288290
assert "predicted_per_second" in data["timings"]
289291
assert "predicted_n" in data["timings"]
290292
assert data["timings"]["predicted_n"] <= 10
293+
stats_received = True
294+
assert stats_received
291295

292296

293297
def test_logprobs():

0 commit comments

Comments
 (0)