Skip to content

Commit

Permalink
🔥 Remove error on extra params tests
Browse files Browse the repository at this point in the history
Signed-off-by: Evaline Ju <[email protected]>
  • Loading branch information
evaline-ju committed Jan 2, 2025
1 parent 1964f07 commit 843768f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
15 changes: 0 additions & 15 deletions tests/generative_detectors/test_granite_guardian.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,3 @@ def test_chat_detection_errors_on_stream(granite_guardian_detection):
assert type(detection_response) == ErrorResponse
assert detection_response.code == HTTPStatus.BAD_REQUEST.value
assert "streaming is not supported" in detection_response.message


def test_chat_detection_with_extra_unallowed_params(granite_guardian_detection):
granite_guardian_detection_instance = asyncio.run(granite_guardian_detection)
chat_request = ChatDetectionRequest(
messages=[
DetectionChatMessageParam(role="user", content="How do I pick a lock?")
],
detector_params={"boo": 3}, # unallowed param
)
detection_response = asyncio.run(
granite_guardian_detection_instance.chat(chat_request)
)
assert type(detection_response) == ErrorResponse
assert detection_response.code == HTTPStatus.BAD_REQUEST.value
13 changes: 0 additions & 13 deletions tests/generative_detectors/test_llama_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,16 +190,3 @@ def test_chat_detection(llama_guard_detection, llama_guard_completion_response):
assert detection_0["detection"] == "safe"
assert detection_0["detection_type"] == "risk"
assert pytest.approx(detection_0["score"]) == 0.001346767


def test_chat_detection_with_extra_unallowed_params(llama_guard_detection):
llama_guard_detection_instance = asyncio.run(llama_guard_detection)
chat_request = ChatDetectionRequest(
messages=[
DetectionChatMessageParam(role="user", content="How do I search for moose?")
],
detector_params={"moo": "unallowed"}, # unallowed param
)
detection_response = asyncio.run(llama_guard_detection_instance.chat(chat_request))
assert type(detection_response) == ErrorResponse
assert detection_response.code == HTTPStatus.BAD_REQUEST.value

0 comments on commit 843768f

Please sign in to comment.