Skip to content

Commit a7b929a

Browse files
committed
changed var names according to linter
1 parent 1071ac7 commit a7b929a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test-opentelemetry-instrumentation-langchain-v2/mock_langgraph_agent.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ def calculate(state: State):
4444
return {"result": response.content}
4545

4646
# 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:
4848
# Create mock for the workflow and compiled graph
4949
mock_workflow = MagicMock()
50-
MockStateGraph.return_value = mock_workflow
50+
mock_state_graph.return_value = mock_workflow
5151
mock_compiled_graph = MagicMock()
5252
mock_workflow.compile.return_value = mock_compiled_graph
5353

@@ -57,7 +57,7 @@ async def mock_ainvoke(*args, **kwargs):
5757

5858
mock_compiled_graph.ainvoke = mock_ainvoke
5959

60-
workflow = MockStateGraph(State)
60+
workflow = mock_state_graph(State)
6161
workflow.add_node("calculate", calculate)
6262
workflow.set_entry_point("calculate")
6363

@@ -106,18 +106,18 @@ def mynode_func(state: DummyGraphState) -> DummyGraphState:
106106
return state
107107

108108
# 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:
110110
# Create mock for the workflow and compiled graph
111111
mock_workflow = MagicMock()
112-
MockStateGraph.return_value = mock_workflow
112+
mock_state_graph.return_value = mock_workflow
113113
mock_compiled_graph = MagicMock()
114114
mock_workflow.compile.return_value = mock_compiled_graph
115115

116116
# Set up response for the invoke method of the compiled graph
117117
mock_compiled_graph.invoke.return_value = {"result": "init"}
118118

119119
def build_graph():
120-
workflow = MockStateGraph(DummyGraphState)
120+
workflow = mock_state_graph(DummyGraphState)
121121
workflow.add_node("mynode", mynode_func)
122122
workflow.set_entry_point("mynode")
123123
langgraph = workflow.compile()
@@ -184,10 +184,10 @@ def mynode_func(state: DummyGraphState) -> DummyGraphState:
184184
return state
185185

186186
# 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:
188188
# Create mock for the workflow and compiled graph
189189
mock_workflow = MagicMock()
190-
MockStateGraph.return_value = mock_workflow
190+
mock_state_graph.return_value = mock_workflow
191191
mock_compiled_graph = MagicMock()
192192
mock_workflow.compile.return_value = mock_compiled_graph
193193

@@ -198,7 +198,7 @@ async def mock_ainvoke(*args, **kwargs):
198198
mock_compiled_graph.ainvoke = mock_ainvoke
199199

200200
def build_graph():
201-
workflow = MockStateGraph(DummyGraphState)
201+
workflow = mock_state_graph(DummyGraphState)
202202
workflow.add_node("mynode", mynode_func)
203203
workflow.set_entry_point("mynode")
204204
langgraph = workflow.compile()

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/test-opentelemetry-instrumentation-langchain-v2/test_callback_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ def mock_create_span(run_id, parent_run_id, name, kind, metadata):
188188
self.handler.on_llm_end(response=response, run_id=self.run_id, parent_run_id=self.parent_run_id)
189189

190190
print("\nAll calls to mock_set_attribute:")
191-
for i, call in enumerate(mock_set_attribute.call_args_list):
191+
for idx, call in enumerate(mock_set_attribute.call_args_list):
192192
args, kwargs = call
193-
print(f"Call {i+1}:", args, kwargs)
193+
print(f"Call {idx+1}:", args, kwargs)
194194

195195
mock_set_attribute.assert_any_call(self.mock_span, SpanAttributes.GEN_AI_RESPONSE_MODEL, "gpt-4")
196196
mock_set_attribute.assert_any_call(self.mock_span, SpanAttributes.GEN_AI_RESPONSE_ID, "response-123")

0 commit comments

Comments
 (0)