Skip to content

Commit d990e2a

Browse files
committed
lint code
1 parent e1d177b commit d990e2a

File tree

9 files changed

+151
-159
lines changed

9 files changed

+151
-159
lines changed

libs/miroflow-contrib/tests/tracing/deprecated_tracing_errors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,9 @@ async def test_handoffs_lead_to_correct_agent_spans():
383383
)
384384
result = await Runner.run(agent_3, input="user_message")
385385

386-
assert result.last_agent == agent_3, (
387-
f"should have ended on the third agent, got {result.last_agent.name}"
388-
)
386+
assert (
387+
result.last_agent == agent_3
388+
), f"should have ended on the third agent, got {result.last_agent.name}"
389389

390390
assert fetch_normalized_spans() == snapshot(
391391
[

libs/miroflow-contrib/tests/tracing/deprecated_tracing_errors_streamed.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,9 @@ async def test_handoffs_lead_to_correct_agent_spans():
404404
async for _ in result.stream_events():
405405
pass
406406

407-
assert result.last_agent == agent_3, (
408-
f"should have ended on the third agent, got {result.last_agent.name}"
409-
)
407+
assert (
408+
result.last_agent == agent_3
409+
), f"should have ended on the third agent, got {result.last_agent.name}"
410410

411411
assert fetch_normalized_spans() == snapshot(
412412
[

libs/miroflow-contrib/tests/tracing/test_trace_processor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ def test_batch_trace_processor_shutdown_flushes(mocked_exporter):
145145
batch = call_args[0][0]
146146
total_exported += len(batch)
147147

148-
assert total_exported == 2, (
149-
"All items in the queue should be exported upon shutdown"
150-
)
148+
assert (
149+
total_exported == 2
150+
), "All items in the queue should be exported upon shutdown"
151151

152152

153153
def test_batch_trace_processor_scheduled_export(mocked_exporter):

libs/miroflow-tool/tests/test_audio_mcp_server.py

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -119,26 +119,24 @@ async def test_audio_transcription(self, test_case: Dict[str, Any]):
119119
# Test successful execution - should not contain error indicators
120120
error_indicators = ["error", "failed", "exception", "traceback"]
121121
for indicator in error_indicators:
122-
assert indicator not in result_str, (
123-
f"Unexpected error indicator '{indicator}' found in successful test result: {result}"
124-
)
122+
assert (
123+
indicator not in result_str
124+
), f"Unexpected error indicator '{indicator}' found in successful test result: {result}"
125125

126126
# Check for expected content if keywords provided
127127
if "expected_content_keywords" in test_case:
128128
for keyword in test_case["expected_content_keywords"]:
129-
assert keyword.lower() in result_str, (
130-
f"Expected keyword '{keyword}' not found in result: {result}"
131-
)
129+
assert (
130+
keyword.lower() in result_str
131+
), f"Expected keyword '{keyword}' not found in result: {result}"
132132

133133
else:
134134
# Test error handling - should contain error information in the result
135135
if "expected_error_keywords" in test_case:
136136
assert any(
137137
keyword.lower() in result_str
138138
for keyword in test_case["expected_error_keywords"]
139-
), (
140-
f"Expected error keywords {test_case['expected_error_keywords']} not found in result: {result}"
141-
)
139+
), f"Expected error keywords {test_case['expected_error_keywords']} not found in result: {result}"
142140

143141
@pytest.mark.parametrize(
144142
"test_case",
@@ -191,26 +189,24 @@ async def test_audio_question_answering(self, test_case: Dict[str, Any]):
191189
# Test successful execution - should not contain error indicators
192190
error_indicators = ["error", "failed", "exception", "traceback"]
193191
for indicator in error_indicators:
194-
assert indicator not in result_str, (
195-
f"Unexpected error indicator '{indicator}' found in successful test result: {result}"
196-
)
192+
assert (
193+
indicator not in result_str
194+
), f"Unexpected error indicator '{indicator}' found in successful test result: {result}"
197195

198196
# Check for expected content if keywords provided
199197
if "expected_content_keywords" in test_case:
200198
for keyword in test_case["expected_content_keywords"]:
201-
assert keyword.lower() in result_str, (
202-
f"Expected keyword '{keyword}' not found in result: {result}"
203-
)
199+
assert (
200+
keyword.lower() in result_str
201+
), f"Expected keyword '{keyword}' not found in result: {result}"
204202

205203
else:
206204
# Test error handling - should contain error information in the result
207205
if "expected_error_keywords" in test_case:
208206
assert any(
209207
keyword.lower() in result_str
210208
for keyword in test_case["expected_error_keywords"]
211-
), (
212-
f"Expected error keywords {test_case['expected_error_keywords']} not found in result: {result}"
213-
)
209+
), f"Expected error keywords {test_case['expected_error_keywords']} not found in result: {result}"
214210

215211
@pytest.mark.asyncio
216212
async def test_tool_execution_timeout(self):
@@ -235,9 +231,9 @@ async def test_tool_execution_timeout(self):
235231
assert result is not None
236232
# Check that it's not an error result
237233
result_str = str(result).lower()
238-
assert "timeout" not in result_str, (
239-
f"Tool execution reported timeout in result: {result}"
240-
)
234+
assert (
235+
"timeout" not in result_str
236+
), f"Tool execution reported timeout in result: {result}"
241237
except asyncio.TimeoutError:
242238
pytest.fail(f"Tool execution timed out after {timeout_seconds} seconds")
243239

@@ -254,9 +250,9 @@ async def test_invalid_tool_name(self):
254250
result_str = str(result).lower()
255251
# Should contain error information about the invalid tool
256252
error_indicators = ["error", "not found", "invalid", "unknown"]
257-
assert any(indicator in result_str for indicator in error_indicators), (
258-
f"Expected error indicators not found for invalid tool name in result: {result}"
259-
)
253+
assert any(
254+
indicator in result_str for indicator in error_indicators
255+
), f"Expected error indicators not found for invalid tool name in result: {result}"
260256

261257
@pytest.mark.asyncio
262258
async def test_invalid_server_name(self):
@@ -271,9 +267,9 @@ async def test_invalid_server_name(self):
271267
result_str = str(result).lower()
272268
# Should contain error information about the invalid server
273269
error_indicators = ["error", "not found", "invalid", "server"]
274-
assert any(indicator in result_str for indicator in error_indicators), (
275-
f"Expected error indicators not found for invalid server name in result: {result}"
276-
)
270+
assert any(
271+
indicator in result_str for indicator in error_indicators
272+
), f"Expected error indicators not found for invalid server name in result: {result}"
277273

278274
@pytest.mark.parametrize(
279275
"invalid_args",
@@ -296,9 +292,9 @@ async def test_invalid_arguments(self, invalid_args: Dict[str, Any]):
296292
result_str = str(result).lower()
297293
# Should contain error information about invalid arguments
298294
error_indicators = ["error", "invalid", "missing", "required", "empty"]
299-
assert any(indicator in result_str for indicator in error_indicators), (
300-
f"Expected error indicators not found for invalid arguments {invalid_args} in result: {result}"
301-
)
295+
assert any(
296+
indicator in result_str for indicator in error_indicators
297+
), f"Expected error indicators not found for invalid arguments {invalid_args} in result: {result}"
302298

303299
@pytest.mark.integration
304300
@pytest.mark.asyncio

libs/miroflow-tool/tests/test_python_server.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ async def test_tool_definitions_available(self):
8585
"download_file_from_internet_to_sandbox",
8686
]
8787
for expected_tool in expected_tools:
88-
assert expected_tool in tool_names, (
89-
f"Expected tool '{expected_tool}' not found in {tool_names}"
90-
)
88+
assert (
89+
expected_tool in tool_names
90+
), f"Expected tool '{expected_tool}' not found in {tool_names}"
9191

9292
# Test 1: run_python_code - Success cases
9393
@pytest.mark.parametrize(
@@ -418,9 +418,9 @@ async def test_complete_workflow(self):
418418
)
419419
assert upload_result is not None
420420
upload_str = str(upload_result).lower()
421-
assert any(keyword in upload_str for keyword in ["uploaded", "success"]), (
422-
f"File upload failed: {upload_result}"
423-
)
421+
assert any(
422+
keyword in upload_str for keyword in ["uploaded", "success"]
423+
), f"File upload failed: {upload_result}"
424424

425425
# Step 3: Run Python code that uses the uploaded file
426426
code_result = await tool_manager.execute_tool_call(
@@ -433,9 +433,9 @@ async def test_complete_workflow(self):
433433
)
434434
assert code_result is not None
435435
code_str = str(code_result).lower()
436-
assert "hello from test file!" in code_str, (
437-
f"Code execution failed: {code_result}"
438-
)
436+
assert (
437+
"hello from test file!" in code_str
438+
), f"Code execution failed: {code_result}"
439439

440440
# Step 4: Download a file from the internet
441441
download_result = await tool_manager.execute_tool_call(
@@ -503,9 +503,9 @@ def _assert_success_result(self, result: Any, expected_keywords: List[str]):
503503

504504
# Should contain expected keywords
505505
for keyword in expected_keywords:
506-
assert keyword.lower() in result_str, (
507-
f"Expected keyword '{keyword}' not found in result: {result}"
508-
)
506+
assert (
507+
keyword.lower() in result_str
508+
), f"Expected keyword '{keyword}' not found in result: {result}"
509509

510510
def _assert_error_result(self, result: Any, expected_error_keywords: List[str]):
511511
"""Assert that result indicates an error and contains expected error keywords."""
@@ -532,9 +532,9 @@ def _assert_error_result(self, result: Any, expected_error_keywords: List[str]):
532532
for keyword in expected_error_keywords
533533
if keyword.lower() in result_str
534534
]
535-
assert len(found_keywords) > 0, (
536-
f"Expected error keywords {expected_error_keywords} not found in result: {result}"
537-
)
535+
assert (
536+
len(found_keywords) > 0
537+
), f"Expected error keywords {expected_error_keywords} not found in result: {result}"
538538

539539
@pytest.mark.asyncio
540540
async def test_invalid_tool_name(self):

libs/miroflow-tool/tests/test_reading_mcp_server.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ async def test_tool_definitions_available(self):
5656
available_tool_names = [tool["name"] for tool in tools]
5757

5858
for expected_tool in expected_tools:
59-
assert expected_tool in available_tool_names, (
60-
f"Tool {expected_tool} not found in available tools"
61-
)
59+
assert (
60+
expected_tool in available_tool_names
61+
), f"Tool {expected_tool} not found in available tools"
6262

6363
@pytest.mark.parametrize(
6464
"test_case",
@@ -136,9 +136,9 @@ async def test_convert_to_markdown_valid_uris(self, test_case: Dict[str, Any]):
136136

137137
if test_case["should_succeed"] and "expected_content_keywords" in test_case:
138138
for keyword in test_case["expected_content_keywords"]:
139-
assert keyword in result_str, (
140-
f"Expected keyword {keyword} not found in result: {result}"
141-
)
139+
assert (
140+
keyword in result_str
141+
), f"Expected keyword {keyword} not found in result: {result}"
142142

143143
@pytest.mark.parametrize(
144144
"test_case",
@@ -220,9 +220,9 @@ async def test_invalid_tool_name(self):
220220
result_str = str(result).lower()
221221
# Should contain error information about the invalid tool
222222
error_indicators = ["error", "not found", "invalid", "unknown"]
223-
assert any(indicator in result_str for indicator in error_indicators), (
224-
f"Expected error indicators not found for invalid tool name in result: {result}"
225-
)
223+
assert any(
224+
indicator in result_str for indicator in error_indicators
225+
), f"Expected error indicators not found for invalid tool name in result: {result}"
226226

227227
@pytest.mark.asyncio
228228
async def test_invalid_server_name(self):
@@ -239,9 +239,9 @@ async def test_invalid_server_name(self):
239239
result_str = str(result).lower()
240240
# Should contain error information about the invalid server
241241
error_indicators = ["error", "not found", "invalid", "server"]
242-
assert any(indicator in result_str for indicator in error_indicators), (
243-
f"Expected error indicators not found for invalid server name in result: {result}"
244-
)
242+
assert any(
243+
indicator in result_str for indicator in error_indicators
244+
), f"Expected error indicators not found for invalid server name in result: {result}"
245245

246246
@pytest.mark.parametrize(
247247
"invalid_args",
@@ -265,9 +265,9 @@ async def test_invalid_arguments(self, invalid_args: Dict[str, Any]):
265265
result_str = str(result).lower()
266266
# Should contain error information about invalid arguments
267267
error_indicators = ["error", "invalid", "missing", "required"]
268-
assert any(indicator in result_str for indicator in error_indicators), (
269-
f"Expected error indicators not found for invalid arguments {invalid_args} in result: {result}"
270-
)
268+
assert any(
269+
indicator in result_str for indicator in error_indicators
270+
), f"Expected error indicators not found for invalid arguments {invalid_args} in result: {result}"
271271

272272
@pytest.mark.integration
273273
@pytest.mark.asyncio

libs/miroflow-tool/tests/test_reasoning_mcp_server.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -102,26 +102,24 @@ async def test_reasoning(self, test_case: Dict[str, Any]):
102102
# Test successful execution - should not contain error indicators
103103
error_indicators = ["error", "failed", "exception", "traceback"]
104104
for indicator in error_indicators:
105-
assert indicator not in result_str, (
106-
f"Unexpected error indicator '{indicator}' found in successful test result: {result}"
107-
)
105+
assert (
106+
indicator not in result_str
107+
), f"Unexpected error indicator '{indicator}' found in successful test result: {result}"
108108

109109
# Check for expected content if keywords provided
110110
if "expected_content_keywords" in test_case:
111111
for keyword in test_case["expected_content_keywords"]:
112-
assert keyword.lower() in result_str, (
113-
f"Expected keyword '{keyword}' not found in result: {result}"
114-
)
112+
assert (
113+
keyword.lower() in result_str
114+
), f"Expected keyword '{keyword}' not found in result: {result}"
115115

116116
else:
117117
# Test error handling - should contain error information in the result
118118
if "expected_error_keywords" in test_case:
119119
assert any(
120120
keyword.lower() in result_str
121121
for keyword in test_case["expected_error_keywords"]
122-
), (
123-
f"Expected error keywords {test_case['expected_error_keywords']} not found in result: {result}"
124-
)
122+
), f"Expected error keywords {test_case['expected_error_keywords']} not found in result: {result}"
125123

126124
@pytest.mark.asyncio
127125
async def test_tool_execution_timeout(self):
@@ -146,9 +144,9 @@ async def test_tool_execution_timeout(self):
146144
assert result is not None
147145
# Check that it's not an error result
148146
result_str = str(result).lower()
149-
assert "timeout" not in result_str, (
150-
f"Tool execution reported timeout in result: {result}"
151-
)
147+
assert (
148+
"timeout" not in result_str
149+
), f"Tool execution reported timeout in result: {result}"
152150
except asyncio.TimeoutError:
153151
pytest.fail(f"Tool execution timed out after {timeout_seconds} seconds")
154152

@@ -165,9 +163,9 @@ async def test_invalid_tool_name(self):
165163
result_str = str(result).lower()
166164
# Should contain error information about the invalid tool
167165
error_indicators = ["error", "not found", "invalid", "unknown"]
168-
assert any(indicator in result_str for indicator in error_indicators), (
169-
f"Expected error indicators not found for invalid tool name in result: {result}"
170-
)
166+
assert any(
167+
indicator in result_str for indicator in error_indicators
168+
), f"Expected error indicators not found for invalid tool name in result: {result}"
171169

172170
@pytest.mark.asyncio
173171
async def test_invalid_server_name(self):
@@ -182,9 +180,9 @@ async def test_invalid_server_name(self):
182180
result_str = str(result).lower()
183181
# Should contain error information about the invalid server
184182
error_indicators = ["error", "not found", "invalid", "server"]
185-
assert any(indicator in result_str for indicator in error_indicators), (
186-
f"Expected error indicators not found for invalid server name in result: {result}"
187-
)
183+
assert any(
184+
indicator in result_str for indicator in error_indicators
185+
), f"Expected error indicators not found for invalid server name in result: {result}"
188186

189187
@pytest.mark.parametrize(
190188
"invalid_args",
@@ -206,9 +204,9 @@ async def test_invalid_arguments(self, invalid_args: Dict[str, Any]):
206204
result_str = str(result).lower()
207205
# Should contain error information about invalid arguments
208206
error_indicators = ["error", "invalid", "missing", "required", "empty"]
209-
assert any(indicator in result_str for indicator in error_indicators), (
210-
f"Expected error indicators not found for invalid arguments {invalid_args} in result: {result}"
211-
)
207+
assert any(
208+
indicator in result_str for indicator in error_indicators
209+
), f"Expected error indicators not found for invalid arguments {invalid_args} in result: {result}"
212210

213211
@pytest.mark.integration
214212
@pytest.mark.asyncio

0 commit comments

Comments
 (0)