@@ -44,10 +44,10 @@ def calculate(state: State):
44
44
return {"result" : response .content }
45
45
46
46
# Patch StateGraph to avoid actual execution
47
- with patch ("langgraph.graph.StateGraph" , autospec = True ) as MockStateGraph :
47
+ with patch ("langgraph.graph.StateGraph" , autospec = True ) as mock_state_graph :
48
48
# Create mock for the workflow and compiled graph
49
49
mock_workflow = MagicMock ()
50
- MockStateGraph .return_value = mock_workflow
50
+ mock_state_graph .return_value = mock_workflow
51
51
mock_compiled_graph = MagicMock ()
52
52
mock_workflow .compile .return_value = mock_compiled_graph
53
53
@@ -57,7 +57,7 @@ async def mock_ainvoke(*args, **kwargs):
57
57
58
58
mock_compiled_graph .ainvoke = mock_ainvoke
59
59
60
- workflow = MockStateGraph (State )
60
+ workflow = mock_state_graph (State )
61
61
workflow .add_node ("calculate" , calculate )
62
62
workflow .set_entry_point ("calculate" )
63
63
@@ -106,18 +106,18 @@ def mynode_func(state: DummyGraphState) -> DummyGraphState:
106
106
return state
107
107
108
108
# Patch StateGraph to avoid actual execution
109
- with patch ("langgraph.graph.StateGraph" , autospec = True ) as MockStateGraph :
109
+ with patch ("langgraph.graph.StateGraph" , autospec = True ) as mock_state_graph :
110
110
# Create mock for the workflow and compiled graph
111
111
mock_workflow = MagicMock ()
112
- MockStateGraph .return_value = mock_workflow
112
+ mock_state_graph .return_value = mock_workflow
113
113
mock_compiled_graph = MagicMock ()
114
114
mock_workflow .compile .return_value = mock_compiled_graph
115
115
116
116
# Set up response for the invoke method of the compiled graph
117
117
mock_compiled_graph .invoke .return_value = {"result" : "init" }
118
118
119
119
def build_graph ():
120
- workflow = MockStateGraph (DummyGraphState )
120
+ workflow = mock_state_graph (DummyGraphState )
121
121
workflow .add_node ("mynode" , mynode_func )
122
122
workflow .set_entry_point ("mynode" )
123
123
langgraph = workflow .compile ()
@@ -184,10 +184,10 @@ def mynode_func(state: DummyGraphState) -> DummyGraphState:
184
184
return state
185
185
186
186
# Patch StateGraph to avoid actual execution
187
- with patch ("langgraph.graph.StateGraph" , autospec = True ) as MockStateGraph :
187
+ with patch ("langgraph.graph.StateGraph" , autospec = True ) as mock_state_graph :
188
188
# Create mock for the workflow and compiled graph
189
189
mock_workflow = MagicMock ()
190
- MockStateGraph .return_value = mock_workflow
190
+ mock_state_graph .return_value = mock_workflow
191
191
mock_compiled_graph = MagicMock ()
192
192
mock_workflow .compile .return_value = mock_compiled_graph
193
193
@@ -198,7 +198,7 @@ async def mock_ainvoke(*args, **kwargs):
198
198
mock_compiled_graph .ainvoke = mock_ainvoke
199
199
200
200
def build_graph ():
201
- workflow = MockStateGraph (DummyGraphState )
201
+ workflow = mock_state_graph (DummyGraphState )
202
202
workflow .add_node ("mynode" , mynode_func )
203
203
workflow .set_entry_point ("mynode" )
204
204
langgraph = workflow .compile ()
0 commit comments