Skip to content

Commit ba762f8

Browse files
bsboddenclaude
andcommitted
test: update Interrupt tests for LangGraph 1.0 API
Update all Interrupt object creation and assertions to use the new LangGraph 1.0 API with only 'value' and 'id' fields. Changes: - Replace Interrupt(value=..., resumable=...) with Interrupt(value=..., id=...) - Remove assertions on removed fields (resumable, ns, when) - Add assertions for new 'id' field - Update test documentation to reflect LangGraph 1.0 changes Files updated: - tests/test_issue_113_interrupt_serialization.py (3 tests) - tests/test_jsonplus_redis_serializer_v3.py (3 tests) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9f3f511 commit ba762f8

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

tests/test_issue_113_interrupt_serialization.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def test_interrupt_serialization_roundtrip(redis_url: str) -> None:
5353

5454
serializer = JsonPlusRedisSerializer()
5555

56-
# Create an Interrupt object
57-
original_interrupt = Interrupt(value={"test": "data"}, resumable=True)
56+
# Create an Interrupt object (LangGraph 1.0 API: only value and id)
57+
original_interrupt = Interrupt(value={"test": "data"}, id="test-interrupt-id")
5858

5959
# Serialize it
6060
type_str, serialized = serializer.dumps_typed(original_interrupt)
@@ -68,7 +68,7 @@ def test_interrupt_serialization_roundtrip(redis_url: str) -> None:
6868
f"This causes AttributeError when LangGraph tries to access attributes"
6969
)
7070
assert deserialized.value == {"test": "data"}
71-
assert deserialized.resumable is True
71+
assert deserialized.id == "test-interrupt-id"
7272

7373

7474
def test_interrupt_in_pending_sends(redis_url: str) -> None:
@@ -86,7 +86,7 @@ def test_interrupt_in_pending_sends(redis_url: str) -> None:
8686
# In the real scenario, pending_sends contains tuples of (channel, value)
8787
# where value might be an Interrupt object
8888
pending_sends = [
89-
("__interrupt__", [Interrupt(value={"test": "data"}, resumable=False)]),
89+
("__interrupt__", [Interrupt(value={"test": "data"}, id="pending-interrupt")]),
9090
("messages", ["some message"]),
9191
]
9292

@@ -112,7 +112,7 @@ def test_interrupt_in_pending_sends(redis_url: str) -> None:
112112
f"This is the root cause of 'dict' object has no attribute error"
113113
)
114114
assert value[0].value == {"test": "data"}
115-
assert value[0].resumable is False
115+
assert value[0].id == "pending-interrupt"
116116

117117

118118
def test_interrupt_resume_workflow(redis_url: str) -> None:

tests/test_jsonplus_redis_serializer_v3.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_serialization_roundtrip_interrupt_objects() -> None:
113113
"""Test serialization roundtrip for Interrupt objects (Issue #113)."""
114114
serializer = JsonPlusRedisSerializer()
115115

116-
interrupt = Interrupt(value={"test": "data"}, resumable=True)
116+
interrupt = Interrupt(value={"test": "data"}, id="test-id")
117117

118118
type_str, data_bytes = serializer.dumps_typed(interrupt)
119119

@@ -128,7 +128,7 @@ def test_serialization_roundtrip_interrupt_objects() -> None:
128128
f"This is the Issue #113 regression!"
129129
)
130130
assert result.value == {"test": "data"}
131-
assert result.resumable is True
131+
assert result.id == "test-id"
132132

133133

134134
def test_serialization_roundtrip_nested_interrupts() -> None:
@@ -137,8 +137,8 @@ def test_serialization_roundtrip_nested_interrupts() -> None:
137137

138138
# Interrupt containing another Interrupt in value
139139
nested = Interrupt(
140-
value={"nested": Interrupt(value={"inner": "data"}, resumable=False)},
141-
resumable=True,
140+
value={"nested": Interrupt(value={"inner": "data"}, id="inner-id")},
141+
id="outer-id",
142142
)
143143

144144
type_str, data_bytes = serializer.dumps_typed(nested)
@@ -147,14 +147,15 @@ def test_serialization_roundtrip_nested_interrupts() -> None:
147147
assert isinstance(result, Interrupt)
148148
assert isinstance(result.value["nested"], Interrupt)
149149
assert result.value["nested"].value == {"inner": "data"}
150+
assert result.value["nested"].id == "inner-id"
150151

151152

152153
def test_serialization_roundtrip_list_of_interrupts() -> None:
153154
"""Test serialization of lists containing Interrupt objects."""
154155
serializer = JsonPlusRedisSerializer()
155156

156157
pending_sends = [
157-
("__interrupt__", [Interrupt(value={"test": "data"}, resumable=False)]),
158+
("__interrupt__", [Interrupt(value={"test": "data"}, id="list-interrupt")]),
158159
("messages", ["some message"]),
159160
]
160161

@@ -172,7 +173,7 @@ def test_serialization_roundtrip_list_of_interrupts() -> None:
172173
# CRITICAL: Must be Interrupt object, not dict (Issue #113)
173174
assert isinstance(value[0], Interrupt)
174175
assert value[0].value == {"test": "data"}
175-
assert value[0].resumable is False
176+
assert value[0].id == "list-interrupt"
176177

177178

178179
def test_no_public_dumps_loads_methods() -> None:

0 commit comments

Comments
 (0)