Skip to content

Commit ed81536

Browse files
committed
tests: fix
1 parent 77054cb commit ed81536

File tree

5 files changed

+266
-137
lines changed

5 files changed

+266
-137
lines changed

langgraph/checkpoint/redis/jsonplus_redis.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ def dumps(self, obj: Any) -> bytes:
4343
try:
4444
# Check if this is an Interrupt object that needs special handling
4545
from langgraph.types import Interrupt
46+
4647
if isinstance(obj, Interrupt):
4748
# Serialize Interrupt as a constructor format for proper deserialization
4849
return super().dumps(obj)
4950
except ImportError:
5051
pass
51-
52+
5253
try:
5354
# Fast path: Use orjson for JSON-serializable objects
5455
return orjson.dumps(obj)
@@ -75,7 +76,7 @@ def _revive_if_needed(self, obj: Any) -> Any:
7576
reconstructed. Without this, messages would remain as dictionaries with
7677
'lc', 'type', and 'constructor' fields, causing errors when the application
7778
expects actual message objects with 'role' and 'content' attributes.
78-
79+
7980
This also handles Interrupt objects that may be stored as plain dictionaries
8081
with 'value' and 'id' keys, reconstructing them as proper Interrupt instances
8182
to prevent AttributeError when accessing the 'id' attribute.
@@ -93,7 +94,7 @@ def _revive_if_needed(self, obj: Any) -> Any:
9394
# This converts {'lc': 1, 'type': 'constructor', ...} back to
9495
# the actual LangChain object (e.g., HumanMessage, AIMessage)
9596
return self._reviver(obj)
96-
97+
9798
# Check if this looks like an Interrupt object stored as a plain dict
9899
# Interrupt objects have 'value' and 'id' keys, and possibly nothing else
99100
# We need to be careful not to accidentally convert other dicts
@@ -106,11 +107,12 @@ def _revive_if_needed(self, obj: Any) -> Any:
106107
# Try to reconstruct as an Interrupt object
107108
try:
108109
from langgraph.types import Interrupt
109-
return Interrupt(value=obj["value"], id=obj["id"])
110+
111+
return Interrupt(value=obj["value"], id=obj["id"]) # type: ignore[call-arg]
110112
except (ImportError, TypeError, ValueError):
111113
# If we can't import or construct Interrupt, fall through
112114
pass
113-
115+
114116
# Recursively process nested dicts
115117
return {k: self._revive_if_needed(v) for k, v in obj.items()}
116118
elif isinstance(obj, list):

tests/test_async_store.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66
from uuid import uuid4
77

88
import pytest
9-
from langgraph.store.base import (
10-
GetOp,
11-
Item,
12-
ListNamespacesOp,
13-
PutOp,
14-
SearchOp,
15-
)
9+
from langgraph.store.base import GetOp, Item, ListNamespacesOp, PutOp, SearchOp
1610

1711
from langgraph.store.redis import AsyncRedisStore
1812
from tests.embed_test_utils import CharacterEmbeddings

tests/test_crossslot_integration.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"""Integration tests for CrossSlot error fix in checkpoint operations."""
22

3-
from langgraph.checkpoint.base import (
4-
create_checkpoint,
5-
empty_checkpoint,
6-
)
3+
from langgraph.checkpoint.base import create_checkpoint, empty_checkpoint
74

85
from langgraph.checkpoint.redis import RedisSaver
96

0 commit comments

Comments
 (0)