Skip to content

Commit 6d3dce3

Browse files
committed
Formatting
1 parent 2f4bd54 commit 6d3dce3

File tree

8 files changed

+30
-31
lines changed

8 files changed

+30
-31
lines changed

.ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ inline-quotes = "single"
136136
"PLR2004",
137137
"SLF001",
138138
]
139-
"types.py" = ["D", "E501", "N815"] # Ignore docstring and annotation issues in types.py
139+
"types.py" = ["D", "E501"] # Ignore docstring and annotation issues in types.py
140140
"proto_utils.py" = ["D102", "PLR0911"]
141141
"helpers.py" = ["ANN001", "ANN201", "ANN202"]
142142

tests/server/apps/jsonrpc/test_serialization.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def agent_card_with_api_key():
3232
}
3333
api_key_scheme = APIKeySecurityScheme.model_validate(api_key_scheme_data)
3434

35-
agent_card = AgentCard(
35+
return AgentCard(
3636
name='APIKeyAgent',
3737
description='An agent that uses API Key auth.',
3838
url='http://example.com/apikey-agent',
@@ -44,7 +44,6 @@ def agent_card_with_api_key():
4444
security_schemes={'api_key_auth': SecurityScheme(root=api_key_scheme)},
4545
security=[{'api_key_auth': []}],
4646
)
47-
return agent_card
4847

4948

5049
def test_starlette_agent_card_with_api_key_scheme_alias(
@@ -145,7 +144,7 @@ def test_handle_oversized_payload(agent_card_with_api_key: AgentCard):
145144
assert response.status_code == 413
146145
except Exception as e:
147146
# Depending on server setup, it might just drop the connection for very large payloads
148-
assert isinstance(e, (ConnectionResetError, RuntimeError))
147+
assert isinstance(e, ConnectionResetError | RuntimeError)
149148

150149

151150
def test_handle_unicode_characters(agent_card_with_api_key: AgentCard):

tests/server/request_handlers/test_default_request_handler.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ async def test_get_task_push_notification_config_info_with_config_no_id():
12081208

12091209
set_config_params = TaskPushNotificationConfig(
12101210
task_id='task_1',
1211-
pushNotificationConfig=PushNotificationConfig(
1211+
push_notification_config=PushNotificationConfig(
12121212
url='http://1.example.com'
12131213
),
12141214
)
@@ -1447,7 +1447,7 @@ async def test_list_task_push_notification_config_info_with_config_and_no_id():
14471447
# multiple calls without config id should replace the existing
14481448
set_config_params1 = TaskPushNotificationConfig(
14491449
task_id='task_1',
1450-
pushNotificationConfig=PushNotificationConfig(
1450+
push_notification_config=PushNotificationConfig(
14511451
url='http://1.example.com'
14521452
),
14531453
)
@@ -1457,7 +1457,7 @@ async def test_list_task_push_notification_config_info_with_config_and_no_id():
14571457

14581458
set_config_params2 = TaskPushNotificationConfig(
14591459
task_id='task_1',
1460-
pushNotificationConfig=PushNotificationConfig(
1460+
push_notification_config=PushNotificationConfig(
14611461
url='http://2.example.com'
14621462
),
14631463
)
@@ -1555,7 +1555,7 @@ async def test_delete_no_task_push_notification_config_info():
15551555
result = await request_handler.on_delete_task_push_notification_config(
15561556
params, create_server_call_context()
15571557
)
1558-
assert result == None
1558+
assert result is None
15591559

15601560
params = DeleteTaskPushNotificationConfigParams(
15611561
id='task2', push_notification_config_id='config_non_existant'
@@ -1564,7 +1564,7 @@ async def test_delete_no_task_push_notification_config_info():
15641564
result = await request_handler.on_delete_task_push_notification_config(
15651565
params, create_server_call_context()
15661566
)
1567-
assert result == None
1567+
assert result is None
15681568

15691569

15701570
@pytest.mark.asyncio
@@ -1600,7 +1600,7 @@ async def test_delete_task_push_notification_config_info_with_config():
16001600
params, create_server_call_context()
16011601
)
16021602

1603-
assert result1 == None
1603+
assert result1 is None
16041604

16051605
result2 = await request_handler.on_list_task_push_notification_config(
16061606
ListTaskPushNotificationConfigParams(id='task_1'),
@@ -1640,7 +1640,7 @@ async def test_delete_task_push_notification_config_info_with_config_and_no_id()
16401640
params, create_server_call_context()
16411641
)
16421642

1643-
assert result == None
1643+
assert result is None
16441644

16451645
result2 = await request_handler.on_list_task_push_notification_config(
16461646
ListTaskPushNotificationConfigParams(id='task_1'),

tests/server/request_handlers/test_jsonrpc_handler.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ async def test_set_push_notification_success(self) -> None:
457457
mock_task_store.get.return_value = mock_task
458458
task_push_config = TaskPushNotificationConfig(
459459
task_id=mock_task.id,
460-
pushNotificationConfig=PushNotificationConfig(
460+
push_notification_config=PushNotificationConfig(
461461
url='http://example.com'
462462
),
463463
)
@@ -492,7 +492,7 @@ async def test_get_push_notification_success(self) -> None:
492492
mock_task_store.get.return_value = mock_task
493493
task_push_config = TaskPushNotificationConfig(
494494
task_id=mock_task.id,
495-
pushNotificationConfig=PushNotificationConfig(
495+
push_notification_config=PushNotificationConfig(
496496
url='http://example.com'
497497
),
498498
)
@@ -579,7 +579,7 @@ async def streaming_coro():
579579
)
580580
request.params.configuration = MessageSendConfiguration(
581581
accepted_output_modes=['text'],
582-
pushNotificationConfig=PushNotificationConfig(
582+
push_notification_config=PushNotificationConfig(
583583
url='http://example.com'
584584
),
585585
)
@@ -761,7 +761,7 @@ async def test_push_notifications_not_supported_error(self) -> None:
761761
# Act & Assert
762762
task_push_config = TaskPushNotificationConfig(
763763
task_id='task_123',
764-
pushNotificationConfig=PushNotificationConfig(
764+
push_notification_config=PushNotificationConfig(
765765
url='http://example.com'
766766
),
767767
)
@@ -825,7 +825,7 @@ async def test_on_set_push_notification_no_push_config_store(self) -> None:
825825
# Act
826826
task_push_config = TaskPushNotificationConfig(
827827
task_id=mock_task.id,
828-
pushNotificationConfig=PushNotificationConfig(
828+
push_notification_config=PushNotificationConfig(
829829
url='http://example.com'
830830
),
831831
)
@@ -1049,7 +1049,7 @@ async def test_on_get_push_notification(self) -> None:
10491049
request_handler = AsyncMock(spec=DefaultRequestHandler)
10501050
task_push_config = TaskPushNotificationConfig(
10511051
task_id=mock_task.id,
1052-
pushNotificationConfig=PushNotificationConfig(
1052+
push_notification_config=PushNotificationConfig(
10531053
id='config1', url='http://example.com'
10541054
),
10551055
)
@@ -1085,7 +1085,7 @@ async def test_on_list_push_notification(self) -> None:
10851085
request_handler = AsyncMock(spec=DefaultRequestHandler)
10861086
task_push_config = TaskPushNotificationConfig(
10871087
task_id=mock_task.id,
1088-
pushNotificationConfig=PushNotificationConfig(
1088+
push_notification_config=PushNotificationConfig(
10891089
url='http://example.com'
10901090
),
10911091
)
@@ -1116,9 +1116,9 @@ async def test_on_list_push_notification_error(self) -> None:
11161116

11171117
# Create request handler without a push notifier
11181118
request_handler = AsyncMock(spec=DefaultRequestHandler)
1119-
task_push_config = TaskPushNotificationConfig(
1119+
_ = TaskPushNotificationConfig(
11201120
task_id=mock_task.id,
1121-
pushNotificationConfig=PushNotificationConfig(
1121+
push_notification_config=PushNotificationConfig(
11221122
url='http://example.com'
11231123
),
11241124
)

tests/server/tasks/test_database_push_notification_config_store.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ async def test_decryption_error_with_wrong_key(
355355
PushNotificationConfigModel, (task_id, 'config-1')
356356
)
357357

358-
with pytest.raises(ValueError) as exc_info:
358+
with pytest.raises(ValueError):
359359
store2._from_orm(db_model) # type: ignore
360360

361361

@@ -386,7 +386,7 @@ async def test_decryption_error_with_no_key(
386386
PushNotificationConfigModel, (task_id, 'config-1')
387387
)
388388

389-
with pytest.raises(ValueError) as exc_info:
389+
with pytest.raises(ValueError):
390390
store2._from_orm(db_model) # type: ignore
391391

392392

@@ -560,5 +560,5 @@ async def test_parsing_error_after_successful_decryption(
560560
PushNotificationConfigModel, (task_id, config_id)
561561
)
562562

563-
with pytest.raises(ValueError) as exc_info:
563+
with pytest.raises(ValueError):
564564
db_store_parameterized._from_orm(db_model_retrieved) # type: ignore

tests/server/tasks/test_task_updater.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ async def test_add_artifact_generates_id(
147147
assert isinstance(event, TaskArtifactUpdateEvent)
148148
assert event.artifact.artifact_id == str(known_uuid)
149149
assert event.artifact.parts == sample_parts
150-
assert event.append == None
151-
assert event.last_chunk == None
150+
assert event.append is None
151+
assert event.last_chunk is None
152152

153153

154154
@pytest.mark.asyncio

tests/server/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def test_set_push_notification_config(
457457
# Setup mock response
458458
task_push_config = TaskPushNotificationConfig(
459459
task_id='t2',
460-
pushNotificationConfig=PushNotificationConfig(
460+
push_notification_config=PushNotificationConfig(
461461
url='https://example.com', token='secret-token'
462462
),
463463
)

tests/test_types.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ def test_send_message_streaming_artifact_update_response() -> None:
741741
def test_set_task_push_notification_response() -> None:
742742
task_push_config = TaskPushNotificationConfig(
743743
task_id='t2',
744-
pushNotificationConfig=PushNotificationConfig(
744+
push_notification_config=PushNotificationConfig(
745745
url='https://example.com', token='token'
746746
),
747747
)
@@ -802,7 +802,7 @@ def test_set_task_push_notification_response() -> None:
802802
def test_get_task_push_notification_response() -> None:
803803
task_push_config = TaskPushNotificationConfig(
804804
task_id='t2',
805-
pushNotificationConfig=PushNotificationConfig(
805+
push_notification_config=PushNotificationConfig(
806806
url='https://example.com', token='token'
807807
),
808808
)
@@ -914,7 +914,7 @@ def test_a2a_request_root_model() -> None:
914914
# SetTaskPushNotificationConfigRequest
915915
task_push_config = TaskPushNotificationConfig(
916916
task_id='t2',
917-
pushNotificationConfig=PushNotificationConfig(
917+
push_notification_config=PushNotificationConfig(
918918
url='https://example.com', token='token'
919919
),
920920
)
@@ -1022,7 +1022,7 @@ def test_a2a_request_root_model_id_validation() -> None:
10221022
# SetTaskPushNotificationConfigRequest
10231023
task_push_config = TaskPushNotificationConfig(
10241024
task_id='t2',
1025-
pushNotificationConfig=PushNotificationConfig(
1025+
push_notification_config=PushNotificationConfig(
10261026
url='https://example.com', token='token'
10271027
),
10281028
)
@@ -1304,7 +1304,7 @@ def test_task_push_notification_config() -> None:
13041304
assert push_notification_config.authentication == auth_info
13051305

13061306
task_push_notification_config = TaskPushNotificationConfig(
1307-
task_id='task-123', pushNotificationConfig=push_notification_config
1307+
task_id='task-123', push_notification_config=push_notification_config
13081308
)
13091309
assert task_push_notification_config.task_id == 'task-123'
13101310
assert (

0 commit comments

Comments
 (0)