Skip to content

Commit

Permalink
Update tests assertion to be less strict
Browse files Browse the repository at this point in the history
  • Loading branch information
kxtran committed May 23, 2024
1 parent 9edda2a commit 6be99d7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/test_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_genai_chat(google_model):

text = response.text
assert isinstance(text, str)
assert "this is a test" in text.lower()
assert text, "No output from the model."


@pytest.mark.chat
Expand Down
5 changes: 3 additions & 2 deletions tests/test_langchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ def test_chat_openai_messages(openai_model):
messages = [SystemMessage(content="You are a ping pong machine"), HumanMessage(content="Ping?")]
completion = llm.predict_messages(messages)

assert isinstance(completion.content, str)
assert "pong" in completion.content.lower()
content = completion.content
assert isinstance(content, str)
assert content, "No output from the model."


@pytest.mark.chat
Expand Down
3 changes: 2 additions & 1 deletion tests/test_magentic.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,6 @@ async def _generate_title_and_description(query: str, widget_data: str) -> Widge

assert isinstance(r, WidgetInfo)
assert isinstance(r.title, str)
assert "AAPL" in r.title
assert isinstance(r.description, str)
assert r.title, "No title generated."
assert r.description, "No description generated."
3 changes: 0 additions & 3 deletions tests/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def test_chat(openai_model):
content = completion.choices[0].message.content
assert isinstance(content, str)
assert content, "No output from the model."
assert "did not go to the market" in content


@pytest.mark.chat
Expand Down Expand Up @@ -68,7 +67,6 @@ async def test_chat_async(openai_model):
content = completion.choices[0].message.content
assert isinstance(content, str)
assert content, "No output from the model."
assert "this is a test" in content.lower()


@pytest.mark.chat
Expand Down Expand Up @@ -139,7 +137,6 @@ def test_chat_image(openai_vision_model):
content = response.choices[0].message.content
assert isinstance(content, str)
assert content, "No output from the model."
assert "ant" in content


def get_current_weather(location, unit="fahrenheit"):
Expand Down

0 comments on commit 6be99d7

Please sign in to comment.