fixes to tests

This commit is contained in:
Gabriel Almeida 2023-04-29 07:38:06 -03:00
commit ffb2aad45d
5 changed files with 12 additions and 9 deletions

View file

@ -199,6 +199,7 @@ class SeriesCharacterChainNode(FrontendNode):
"Chain", "Chain",
"ConversationChain", "ConversationChain",
"SeriesCharacterChain", "SeriesCharacterChain",
"function",
] ]

View file

@ -130,7 +130,7 @@ def test_initialize_agent(client: TestClient):
agents = json_response["agents"] agents = json_response["agents"]
initialize_agent = agents["initialize_agent"] initialize_agent = agents["initialize_agent"]
assert initialize_agent["base_classes"] == ["AgentExecutor"] assert initialize_agent["base_classes"] == ["AgentExecutor", "function"]
template = initialize_agent["template"] template = initialize_agent["template"]
assert template["agent"] == { assert template["agent"] == {

View file

@ -20,7 +20,12 @@ def test_conversation_chain(client: TestClient):
chain = chains["ConversationChain"] chain = chains["ConversationChain"]
# Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects # Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects
assert set(chain["base_classes"]) == {"LLMChain", "ConversationChain", "Chain"} assert set(chain["base_classes"]) == {
"function",
"LLMChain",
"ConversationChain",
"Chain",
}
template = chain["template"] template = chain["template"]
assert template["memory"] == { assert template["memory"] == {
"required": False, "required": False,
@ -96,7 +101,7 @@ def test_llm_chain(client: TestClient):
chain = chains["LLMChain"] chain = chains["LLMChain"]
# Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects # Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects
assert set(chain["base_classes"]) == {"LLMChain", "Chain"} assert set(chain["base_classes"]) == {"function", "LLMChain", "Chain"}
template = chain["template"] template = chain["template"]
assert template["memory"] == { assert template["memory"] == {
"required": False, "required": False,
@ -154,7 +159,7 @@ def test_llm_checker_chain(client: TestClient):
chain = chains["LLMCheckerChain"] chain = chains["LLMCheckerChain"]
# Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects # Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects
assert set(chain["base_classes"]) == {"LLMCheckerChain", "Chain"} assert set(chain["base_classes"]) == {"function", "LLMCheckerChain", "Chain"}
template = chain["template"] template = chain["template"]
assert template["memory"] == { assert template["memory"] == {
"required": False, "required": False,
@ -231,7 +236,7 @@ def test_llm_math_chain(client: TestClient):
chain = chains["LLMMathChain"] chain = chains["LLMMathChain"]
# Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects # Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects
assert set(chain["base_classes"]) == {"LLMMathChain", "Chain"} assert set(chain["base_classes"]) == {"function", "LLMMathChain", "Chain"}
template = chain["template"] template = chain["template"]
assert template["memory"] == { assert template["memory"] == {
"required": False, "required": False,
@ -310,6 +315,7 @@ def test_series_character_chain(client: TestClient):
# Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects # Test the base classes, template, memory, verbose, llm, input_key, output_key, and _type objects
assert set(chain["base_classes"]) == { assert set(chain["base_classes"]) == {
"function",
"LLMChain", "LLMChain",
"BaseCustomChain", "BaseCustomChain",
"Chain", "Chain",

View file

@ -1,4 +1,3 @@
import json
from typing import Type, Union from typing import Type, Union
import pytest import pytest

View file

@ -1,6 +1,5 @@
import json import json
from unittest.mock import patch from unittest.mock import patch
from langflow.api.schemas import ChatMessage
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
@ -11,8 +10,6 @@ def test_websocket_connection(client: TestClient):
def test_chat_history(client: TestClient): def test_chat_history(client: TestClient):
chat_history = []
# Mock the process_graph function to return a specific value # Mock the process_graph function to return a specific value
with patch("langflow.api.chat_manager.process_graph") as mock_process_graph: with patch("langflow.api.chat_manager.process_graph") as mock_process_graph:
mock_process_graph.return_value = ("Hello, I'm a mock response!", "") mock_process_graph.return_value = ("Hello, I'm a mock response!", "")