Skip to content

Commit 80913e7

Browse files
committed
tidy up notification to reduce copy paste
1 parent 9da2d58 commit 80913e7

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

tests/client/test_session.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ async def test_client_session_progress():
261261
SessionMessage
262262
](1)
263263

264+
send_notification_count = 10
265+
264266
async def mock_server():
265267
session_message = await client_to_server_receive.receive()
266268
jsonrpc_request = session_message.message
@@ -273,24 +275,16 @@ async def mock_server():
273275
assert request.root.params.meta.progressToken is not None
274276

275277
progress_token = request.root.params.meta.progressToken
276-
277278
notifications = [
278279
types.ServerNotification(
279280
root=types.ProgressNotification(
280281
params=types.ProgressNotificationParams(
281-
progressToken=progress_token, progress=1
282+
progressToken=progress_token, progress=i
282283
),
283284
method="notifications/progress",
284285
)
285-
),
286-
types.ServerNotification(
287-
root=types.ProgressNotification(
288-
params=types.ProgressNotificationParams(
289-
progressToken=progress_token, progress=2
290-
),
291-
method="notifications/progress",
292-
)
293-
),
286+
)
287+
for i in range(send_notification_count)
294288
]
295289
result = ServerResult(types.CallToolResult(content=[]))
296290

@@ -358,4 +352,4 @@ async def progress_callback(params: types.ProgressNotificationParams):
358352
# Assert the result
359353
assert isinstance(result, types.CallToolResult)
360354
assert len(result.content) == 0
361-
assert progress_count == 2
355+
assert progress_count == send_notification_count

0 commit comments

Comments
 (0)