From 4a92a39fde6866cc4e9ed2836da0cfc9d51364a5 Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Mon, 17 Jun 2024 12:01:18 -0400 Subject: [PATCH] add test to confirm "stop" not in payload when it is not supplied --- libs/ai-endpoints/tests/unit_tests/test_stop.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libs/ai-endpoints/tests/unit_tests/test_stop.py b/libs/ai-endpoints/tests/unit_tests/test_stop.py index 31ebe0bc..494ad929 100644 --- a/libs/ai-endpoints/tests/unit_tests/test_stop.py +++ b/libs/ai-endpoints/tests/unit_tests/test_stop.py @@ -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( @@ -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