Skip to content

Commit 1b6f196

Browse files
Copilotpontemonti
andcommitted
Run ruff format to fix code formatting
Co-authored-by: pontemonti <7850950+pontemonti@users.noreply.github.com>
1 parent daed65e commit 1b6f196

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

libraries/microsoft-agents-a365-tooling/microsoft_agents_a365/tooling/services/mcp_tool_server_configuration_service.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -535,21 +535,23 @@ async def send_chat_history(
535535
# Extract required information from turn context
536536
if not turn_context.activity:
537537
raise ValueError("turn_context.activity cannot be None")
538-
538+
539539
conversation_id = (
540-
turn_context.activity.conversation.id
541-
if turn_context.activity.conversation
542-
else None
540+
turn_context.activity.conversation.id if turn_context.activity.conversation else None
543541
)
544542
message_id = turn_context.activity.id
545543
user_message = turn_context.activity.text
546544

547545
if not conversation_id:
548-
raise ValueError("conversation_id cannot be empty or None (from turn_context.activity.conversation.id)")
546+
raise ValueError(
547+
"conversation_id cannot be empty or None (from turn_context.activity.conversation.id)"
548+
)
549549
if not message_id:
550550
raise ValueError("message_id cannot be empty or None (from turn_context.activity.id)")
551551
if not user_message:
552-
raise ValueError("user_message cannot be empty or None (from turn_context.activity.text)")
552+
raise ValueError(
553+
"user_message cannot be empty or None (from turn_context.activity.text)"
554+
)
553555

554556
# Use default options if none provided
555557
if options is None:
@@ -597,9 +599,7 @@ async def send_chat_history(
597599
)
598600

599601
except aiohttp.ClientError as http_ex:
600-
self._logger.error(
601-
f"HTTP error sending chat history to '{endpoint}': {str(http_ex)}"
602-
)
602+
self._logger.error(f"HTTP error sending chat history to '{endpoint}': {str(http_ex)}")
603603
return OperationResult.failed(OperationError(http_ex))
604604
except asyncio.TimeoutError as timeout_ex:
605605
self._logger.error(
@@ -609,4 +609,3 @@ async def send_chat_history(
609609
except Exception as ex:
610610
self._logger.error(f"Failed to send chat history to '{endpoint}': {str(ex)}")
611611
return OperationResult.failed(OperationError(ex))
612-

tests/tooling/services/test_send_chat_history.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ def test_send_chat_history_validates_turn_context(self, service, chat_history_me
129129
# Act & Assert
130130
with pytest.raises(ValueError, match="turn_context cannot be empty or None"):
131131
import asyncio
132+
132133
asyncio.run(service.send_chat_history(None, chat_history_messages))
133134

134-
def test_send_chat_history_validates_chat_history_messages(
135-
self, service, mock_turn_context
136-
):
135+
def test_send_chat_history_validates_chat_history_messages(self, service, mock_turn_context):
137136
"""Test that send_chat_history validates chat_history_messages parameter."""
138137
# Act & Assert
139138
with pytest.raises(ValueError, match="chat_history_messages cannot be empty or None"):
140139
import asyncio
140+
141141
asyncio.run(service.send_chat_history(mock_turn_context, None))
142142

143143
def test_send_chat_history_validates_activity(self, service, chat_history_messages):
@@ -149,6 +149,7 @@ def test_send_chat_history_validates_activity(self, service, chat_history_messag
149149
# Act & Assert
150150
with pytest.raises(ValueError, match="turn_context.activity cannot be None"):
151151
import asyncio
152+
152153
asyncio.run(service.send_chat_history(mock_context, chat_history_messages))
153154

154155
def test_send_chat_history_validates_conversation_id(self, service, chat_history_messages):
@@ -163,9 +164,11 @@ def test_send_chat_history_validates_conversation_id(self, service, chat_history
163164

164165
# Act & Assert
165166
with pytest.raises(
166-
ValueError, match="conversation_id cannot be empty or None.*turn_context.activity.conversation.id"
167+
ValueError,
168+
match="conversation_id cannot be empty or None.*turn_context.activity.conversation.id",
167169
):
168170
import asyncio
171+
169172
asyncio.run(service.send_chat_history(mock_context, chat_history_messages))
170173

171174
def test_send_chat_history_validates_message_id(self, service, chat_history_messages):
@@ -185,6 +188,7 @@ def test_send_chat_history_validates_message_id(self, service, chat_history_mess
185188
ValueError, match="message_id cannot be empty or None.*turn_context.activity.id"
186189
):
187190
import asyncio
191+
188192
asyncio.run(service.send_chat_history(mock_context, chat_history_messages))
189193

190194
def test_send_chat_history_validates_user_message(self, service, chat_history_messages):
@@ -204,6 +208,7 @@ def test_send_chat_history_validates_user_message(self, service, chat_history_me
204208
ValueError, match="user_message cannot be empty or None.*turn_context.activity.text"
205209
):
206210
import asyncio
211+
207212
asyncio.run(service.send_chat_history(mock_context, chat_history_messages))
208213

209214
@pytest.mark.asyncio

0 commit comments

Comments
 (0)