From 220cf7f7809e4d69cd6322c7d315b80a5650b147 Mon Sep 17 00:00:00 2001 From: MichelleTPY Date: Fri, 13 Dec 2024 19:22:15 +0000 Subject: [PATCH] Add unit test to check `has_new_line` JSON response --- examples/server/tests/unit/test_completion.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/server/tests/unit/test_completion.py b/examples/server/tests/unit/test_completion.py index 7f4f9cd03..c4ae81fec 100644 --- a/examples/server/tests/unit/test_completion.py +++ b/examples/server/tests/unit/test_completion.py @@ -25,6 +25,7 @@ def test_completion(prompt: str, n_predict: int, re_content: str, n_prompt: int, assert res.body["timings"]["prompt_n"] == n_prompt assert res.body["timings"]["predicted_n"] == n_predicted assert res.body["truncated"] == truncated + assert res.body["has_new_line"] == False assert match_regex(re_content, res.body["content"]) @@ -47,6 +48,7 @@ def test_completion_stream(prompt: str, n_predict: int, re_content: str, n_promp assert data["timings"]["prompt_n"] == n_prompt assert data["timings"]["predicted_n"] == n_predicted assert data["truncated"] == truncated + assert data["has_new_line"] == False assert data["stop_type"] == "limit" assert "generation_settings" in data assert server.n_predict is not None