@@ -178,10 +178,10 @@ def test_name_validation_critical_cases(self):
178
178
"""Test name validation - the original issue that started this PR"""
179
179
# This was the original failing case that caused JSON serialization errors
180
180
with pytest .raises (TypeError , match = "Agent name must be a string, got int" ):
181
- Agent (name = 1 )
181
+ Agent (name = 1 ) # type: ignore
182
182
183
183
with pytest .raises (TypeError , match = "Agent name must be a string, got NoneType" ):
184
- Agent (name = None )
184
+ Agent (name = None ) # type: ignore
185
185
186
186
def test_tool_use_behavior_dict_validation (self ):
187
187
"""Test tool_use_behavior accepts StopAtTools dict - fixes existing test failures"""
@@ -190,7 +190,7 @@ def test_tool_use_behavior_dict_validation(self):
190
190
191
191
# Invalid cases that should fail
192
192
with pytest .raises (TypeError , match = "Agent tool_use_behavior must be" ):
193
- Agent (name = "test" , tool_use_behavior = 123 )
193
+ Agent (name = "test" , tool_use_behavior = 123 ) # type: ignore
194
194
195
195
def test_hooks_validation_python39_compatibility (self ):
196
196
"""Test hooks validation works with Python 3.9 - fixes generic type issues"""
@@ -199,20 +199,20 @@ class MockHooks(AgentHooksBase):
199
199
pass
200
200
201
201
# Valid case
202
- Agent (name = "test" , hooks = MockHooks ())
202
+ Agent (name = "test" , hooks = MockHooks ()) # type: ignore
203
203
204
204
# Invalid case
205
205
with pytest .raises (TypeError , match = "Agent hooks must be an AgentHooks instance" ):
206
- Agent (name = "test" , hooks = "invalid" )
206
+ Agent (name = "test" , hooks = "invalid" ) # type: ignore
207
207
208
208
def test_list_field_validation (self ):
209
209
"""Test critical list fields that commonly get wrong types"""
210
210
# These are the most common mistakes users make
211
211
with pytest .raises (TypeError , match = "Agent tools must be a list" ):
212
- Agent (name = "test" , tools = "not_a_list" )
212
+ Agent (name = "test" , tools = "not_a_list" ) # type: ignore
213
213
214
214
with pytest .raises (TypeError , match = "Agent handoffs must be a list" ):
215
- Agent (name = "test" , handoffs = "not_a_list" )
215
+ Agent (name = "test" , handoffs = "not_a_list" ) # type: ignore
216
216
217
217
def test_model_settings_validation (self ):
218
218
"""Test model_settings validation - prevents runtime errors"""
@@ -223,4 +223,4 @@ def test_model_settings_validation(self):
223
223
with pytest .raises (
224
224
TypeError , match = "Agent model_settings must be a ModelSettings instance"
225
225
):
226
- Agent (name = "test" , model_settings = {})
226
+ Agent (name = "test" , model_settings = {}) # type: ignore
0 commit comments