From 020d10138dcda2829c2401fa9b84ce460184d086 Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Wed, 22 Jan 2025 12:39:18 -0500 Subject: [PATCH] add test case --- libs/langgraph/tests/test_pregel.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/langgraph/tests/test_pregel.py b/libs/langgraph/tests/test_pregel.py index 319ceed1c..d71c18306 100644 --- a/libs/langgraph/tests/test_pregel.py +++ b/libs/langgraph/tests/test_pregel.py @@ -5087,6 +5087,23 @@ def test_interrupt_task_functional( res = graph.invoke(Command(resume="bar"), config) assert res == {"a": "foobar"} + # Test that we can interrupt the same task multiple times + config = {"configurable": {"thread_id": "2"}} + + @entrypoint(checkpointer=checkpointer) + def graph(inputs: dict) -> dict: + foo_result = foo(inputs).result() + bar_result = bar(foo_result).result() + baz_result = bar(bar_result).result() + return baz_result + + # First run, interrupted at bar + graph.invoke({"a": ""}, config) + # Provide resumes + graph.invoke(Command(resume="bar"), config) + res_2 = graph.invoke(Command(resume="baz"), config) + assert res_2 == {"a": "foobarbaz"} # Errors, produces "foobarbar" instead + def test_root_mixed_return() -> None: def my_node(state: list[str]):