Skip to content

Commit 86e3f97

Browse files
authored
Update test_client_factory.py
1 parent 16b40a4 commit 86e3f97

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tests/client/test_client_factory.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,31 @@ def test_client_factory_no_compatible_transport(base_agent_card: AgentCard):
105105
factory.create(base_agent_card)
106106

107107

108-
def test_client_factory_invalid_transport_in_config(base_agent_card: AgentCard):
109-
"""Verify that the factory raises an error for an unknown transport type."""
108+
@pytest.mark.parametrize(
109+
('invalid_transports', 'expected_match'),
110+
[
111+
(
112+
['invalid-transport'],
113+
"Unsupported transport type\\(s\\) in ClientConfig: 'invalid-transport'",
114+
),
115+
(
116+
['invalid-1', 'another-bad-one'],
117+
"Unsupported transport type\\(s\\) in ClientConfig: 'another-bad-one', 'invalid-1'",
118+
),
119+
],
120+
)
121+
def test_client_factory_invalid_transport_in_config(
122+
base_agent_card: AgentCard, invalid_transports, expected_match
123+
):
124+
"""Verify that the factory raises an error for unknown transport types."""
110125
config = ClientConfig(
111126
httpx_client=httpx.AsyncClient(),
112127
supported_transports=[
113128
TransportProtocol.jsonrpc,
114-
'invalid-transport-protocol',
129+
*invalid_transports,
115130
],
116131
)
117132
factory = ClientFactory(config)
118-
with pytest.raises(
119-
ValueError, match='Unsupported transport type in ClientConfig'
120-
):
133+
with pytest.raises(ValueError, match=expected_match):
121134
factory.create(base_agent_card)
135+

0 commit comments

Comments
 (0)