Skip to content

Commit

Permalink
add test to confirm "stop" not in payload when it is not supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
mattf committed Jun 18, 2024
1 parent 6dcad7d commit 4a92a39
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions libs/ai-endpoints/tests/unit_tests/test_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,16 @@ def mock_v1_chat_completions(requests_mock: Mocker) -> None:
(["PROP"], None, ["PROP"]),
(["PROP"], ["PARAM"], ["PARAM"]),
(["PROP"], "PARAM", "PARAM"),
(None, None, None),
],
ids=[
"parameter_seq",
"parameter_str",
"property",
"override_seq",
"override_str",
"absent",
],
ids=["parameter_seq", "parameter_str", "property", "override_seq", "override_str"],
)
@pytest.mark.parametrize("func_name", ["invoke", "stream"])
def test_stop(
Expand Down Expand Up @@ -89,5 +97,8 @@ def test_stop(

assert requests_mock.last_request is not None
request_payload = requests_mock.last_request.json()
assert "stop" in request_payload
assert request_payload["stop"] == expected_stop
if expected_stop:
assert "stop" in request_payload
assert request_payload["stop"] == expected_stop
else:
assert "stop" not in request_payload

0 comments on commit 4a92a39

Please sign in to comment.