@@ -154,6 +154,46 @@ def create(
154154 assert actual is fake_sdk_client
155155
156156
157+ @pytest .mark .asyncio
158+ async def test_build_client_enables_sdk_polling_when_polling_fallback_enabled (
159+ monkeypatch : pytest .MonkeyPatch ,
160+ ) -> None :
161+ client = A2AClient (
162+ "http://agent.example.com" ,
163+ settings = A2AClientSettings (polling_fallback_enabled = True ),
164+ )
165+ fake_sdk_client = _FakeClient ()
166+ factory_calls : dict [str , object ] = {}
167+
168+ class _FakeFactory :
169+ def __init__ (self , config : ClientConfig , consumers : list [object ] | None = None ):
170+ factory_calls ["config" ] = config
171+ factory_calls ["consumers" ] = consumers
172+
173+ def create (
174+ self ,
175+ _card : object ,
176+ consumers : list [object ] | None = None ,
177+ interceptors : list [object ] | None = None ,
178+ extensions : list [str ] | None = None ,
179+ ) -> _FakeClient :
180+ return fake_sdk_client
181+
182+ monkeypatch .setattr (client_module , "ClientFactory" , _FakeFactory )
183+ monkeypatch .setattr (
184+ client_module ,
185+ "build_agent_card_resolver" ,
186+ lambda * _args : _FakeCardResolver ("agent-card" ),
187+ )
188+
189+ actual = await client ._build_client ()
190+
191+ config = factory_calls ["config" ]
192+ assert isinstance (config , ClientConfig )
193+ assert config .polling is True
194+ assert actual is fake_sdk_client
195+
196+
157197@pytest .mark .asyncio
158198async def test_send_returns_last_event (monkeypatch : pytest .MonkeyPatch ) -> None :
159199 client = A2AClient ("http://agent.example.com" )
0 commit comments