@@ -260,20 +260,22 @@ class MyModel(BaseModel):
260260@parametrize
261261@pytest .mark .asyncio
262262async def test_pydantic_model_to_dictionary (use_async : bool ) -> None :
263- assert await transform (MyModel (foo = "hi!" ), Any , use_async ) == {"foo" : "hi!" }
264- assert await transform (MyModel .construct (foo = "hi!" ), Any , use_async ) == {"foo" : "hi!" }
263+ assert cast ( Any , await transform (MyModel (foo = "hi!" ), Any , use_async ) ) == {"foo" : "hi!" }
264+ assert cast ( Any , await transform (MyModel .construct (foo = "hi!" ), Any , use_async ) ) == {"foo" : "hi!" }
265265
266266
267267@parametrize
268268@pytest .mark .asyncio
269269async def test_pydantic_empty_model (use_async : bool ) -> None :
270- assert await transform (MyModel .construct (), Any , use_async ) == {}
270+ assert cast ( Any , await transform (MyModel .construct (), Any , use_async ) ) == {}
271271
272272
273273@parametrize
274274@pytest .mark .asyncio
275275async def test_pydantic_unknown_field (use_async : bool ) -> None :
276- assert await transform (MyModel .construct (my_untyped_field = True ), Any , use_async ) == {"my_untyped_field" : True }
276+ assert cast (Any , await transform (MyModel .construct (my_untyped_field = True ), Any , use_async )) == {
277+ "my_untyped_field" : True
278+ }
277279
278280
279281@parametrize
@@ -285,7 +287,7 @@ async def test_pydantic_mismatched_types(use_async: bool) -> None:
285287 params = await transform (model , Any , use_async )
286288 else :
287289 params = await transform (model , Any , use_async )
288- assert params == {"foo" : True }
290+ assert cast ( Any , params ) == {"foo" : True }
289291
290292
291293@parametrize
@@ -297,7 +299,7 @@ async def test_pydantic_mismatched_object_type(use_async: bool) -> None:
297299 params = await transform (model , Any , use_async )
298300 else :
299301 params = await transform (model , Any , use_async )
300- assert params == {"foo" : {"hello" : "world" }}
302+ assert cast ( Any , params ) == {"foo" : {"hello" : "world" }}
301303
302304
303305class ModelNestedObjects (BaseModel ):
@@ -309,7 +311,7 @@ class ModelNestedObjects(BaseModel):
309311async def test_pydantic_nested_objects (use_async : bool ) -> None :
310312 model = ModelNestedObjects .construct (nested = {"foo" : "stainless" })
311313 assert isinstance (model .nested , MyModel )
312- assert await transform (model , Any , use_async ) == {"nested" : {"foo" : "stainless" }}
314+ assert cast ( Any , await transform (model , Any , use_async ) ) == {"nested" : {"foo" : "stainless" }}
313315
314316
315317class ModelWithDefaultField (BaseModel ):
@@ -325,19 +327,19 @@ async def test_pydantic_default_field(use_async: bool) -> None:
325327 model = ModelWithDefaultField .construct ()
326328 assert model .with_none_default is None
327329 assert model .with_str_default == "foo"
328- assert await transform (model , Any , use_async ) == {}
330+ assert cast ( Any , await transform (model , Any , use_async ) ) == {}
329331
330332 # should be included when the default value is explicitly given
331333 model = ModelWithDefaultField .construct (with_none_default = None , with_str_default = "foo" )
332334 assert model .with_none_default is None
333335 assert model .with_str_default == "foo"
334- assert await transform (model , Any , use_async ) == {"with_none_default" : None , "with_str_default" : "foo" }
336+ assert cast ( Any , await transform (model , Any , use_async ) ) == {"with_none_default" : None , "with_str_default" : "foo" }
335337
336338 # should be included when a non-default value is explicitly given
337339 model = ModelWithDefaultField .construct (with_none_default = "bar" , with_str_default = "baz" )
338340 assert model .with_none_default == "bar"
339341 assert model .with_str_default == "baz"
340- assert await transform (model , Any , use_async ) == {"with_none_default" : "bar" , "with_str_default" : "baz" }
342+ assert cast ( Any , await transform (model , Any , use_async ) ) == {"with_none_default" : "bar" , "with_str_default" : "baz" }
341343
342344
343345class TypedDictIterableUnion (TypedDict ):
0 commit comments