update test

This commit is contained in:
Xuan Son Nguyen 2024-12-08 21:29:05 +01:00
parent a4d2572494
commit ac2ea5382c
2 changed files with 24 additions and 1 deletions

View file

@ -34,7 +34,7 @@ def test_infill_with_input_extra():
"input_suffix": "}\n",
})
assert res.status_code == 200
assert match_regex("(cuts|Jimmy|mom|came|into|the|room)+", res.body["content"])
assert match_regex("(help|find|band)+", res.body["content"])
@pytest.mark.parametrize("input_extra", [
@ -55,3 +55,23 @@ def test_invalid_input_extra_req(input_extra):
})
assert res.status_code == 400
assert "error" in res.body
@pytest.mark.skipif(not is_slow_test_allowed(), reason="skipping slow test")
def test_with_qwen_model():
global server
server.model_file = None
server.model_hf_repo = "Qwen/CodeQwen1.5-7B-Chat-GGUF"
server.model_hf_file = "codeqwen-1_5-7b-chat-q2_k.gguf"
server.start(timeout_seconds=600)
res = server.make_request("POST", "/infill", data={
"prompt": "Complete this",
"input_extra": [{
"filename": "llama.h",
"text": "LLAMA_API int32_t llama_n_threads();\n"
}],
"input_prefix": "#include <cstdio>\n#include \"llama.h\"\n\nint main() {\n int n_threads = llama_",
"input_suffix": "}\n",
})
assert res.status_code == 200
assert "n_threads" in res.body["content"]

View file

@ -371,3 +371,6 @@ def match_regex(regex: str, text: str) -> bool:
).search(text)
is not None
)
def is_slow_test_allowed():
return os.environ.get("SLOW_TESTS") == "1" or os.environ.get("SLOW_TESTS") == "ON"