🔍 test(graph.py): add assertions to verify expected keywords in source and target fields of processed_flow edges
The test_process_flow_vector_store_grouped function now includes assertions to check if the expected keywords are present in the source and target fields of the edges in the processed_flow dictionary. This ensures that the processing of the flow vector store grouped JSON is correctly generating the edges with the expected connections between nodes.
This commit is contained in:
parent
be5060b5f7
commit
8eae2fa126
1 changed files with 16 additions and 0 deletions
|
|
@ -419,6 +419,22 @@ def test_process_flow_vector_store_grouped(vector_store_grouped_json_flow):
|
|||
assert isinstance(processed_flow, dict)
|
||||
assert "nodes" in processed_flow
|
||||
assert "edges" in processed_flow
|
||||
edges = processed_flow["edges"]
|
||||
# Expected keywords in source and target fields
|
||||
expected_keywords = [
|
||||
{"source": "VectorStoreInfo", "target": "VectorStoreAgent"},
|
||||
{"source": "ChatOpenAI", "target": "VectorStoreAgent"},
|
||||
{"source": "OpenAIEmbeddings", "target": "Chroma"},
|
||||
{"source": "Chroma", "target": "VectorStoreInfo"},
|
||||
{"source": "WebBaseLoader", "target": "RecursiveCharacterTextSplitter"},
|
||||
{"source": "RecursiveCharacterTextSplitter", "target": "Chroma"},
|
||||
]
|
||||
|
||||
for idx, expected_keyword in enumerate(expected_keywords):
|
||||
for key, value in expected_keyword.items():
|
||||
assert (
|
||||
value in edges[idx][key].split("-")[0]
|
||||
), f"Edge {idx}, key {key} expected to contain {value} but got {edges[idx][key]}"
|
||||
|
||||
|
||||
def test_update_template(sample_template, sample_nodes):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue