mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-07 18:27:52 +02:00
fix: handle non-deterministic ordering in test_imp_nested
Nested tasks run concurrently so output order is non-deterministic. Sort intermediate results before comparison, matching the pattern already used by test_imp_task. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
7b034c2d25
commit
bde0c47cd9
@@ -1329,20 +1329,22 @@ def test_imp_nested(
|
||||
}
|
||||
|
||||
thread1 = {"configurable": {"thread_id": "1"}}
|
||||
assert [*graph.stream([0, 1], thread1, durability=durability)] == [
|
||||
{"submapper": "0"},
|
||||
result = [*graph.stream([0, 1], thread1, durability=durability)]
|
||||
# nested tasks run concurrently so output order is non-deterministic
|
||||
assert sorted(result[:-1], key=lambda d: str(d)) == [
|
||||
{"mapper": "00"},
|
||||
{"submapper": "1"},
|
||||
{"mapper": "11"},
|
||||
{
|
||||
"__interrupt__": (
|
||||
Interrupt(
|
||||
value="question",
|
||||
id=AnyStr(),
|
||||
),
|
||||
)
|
||||
},
|
||||
{"submapper": "0"},
|
||||
{"submapper": "1"},
|
||||
]
|
||||
assert result[-1] == {
|
||||
"__interrupt__": (
|
||||
Interrupt(
|
||||
value="question",
|
||||
id=AnyStr(),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
assert graph.invoke(Command(resume="answer"), thread1, durability=durability) == [
|
||||
"00answera",
|
||||
|
||||
Reference in New Issue
Block a user