@@ -55,8 +55,9 @@ async def test_createPet(server, client):
5555 assert type (r ).model_json_schema () == client .components .schemas ["Pet" ].get_type ().model_json_schema ()
5656 assert h ["X-Limit-Remain" ] == 5
5757
58- r = await asyncio .to_thread (client ._ .createPet , data = {"pet" : {"name" : r .name }})
59- assert type (r ).model_json_schema () == client .components .schemas ["Error" ].get_type ().model_json_schema ()
58+ with pytest .raises (aiopenapi3 .errors .HTTPClientError ) as e :
59+ await asyncio .to_thread (client ._ .createPet , data = {"pet" : {"name" : r .name }})
60+ assert type (e .value .data ).model_json_schema () == client .components .schemas ["Error" ].get_type ().model_json_schema ()
6061
6162
6263@pytest .mark .asyncio (loop_scope = "session" )
@@ -74,15 +75,18 @@ async def test_getPet(server, client):
7475 # assert type(r).model_json_schema() == type(pet).model_json_schema()
7576 assert r .id == pet .id
7677
77- r = await asyncio .to_thread (client ._ .getPet , parameters = {"petId" : - 1 })
78- assert type (r ).model_json_schema () == client .components .schemas ["Error" ].get_type ().model_json_schema ()
78+ with pytest .raises (aiopenapi3 .errors .HTTPClientError ) as e :
79+ await asyncio .to_thread (client ._ .getPet , parameters = {"petId" : - 1 })
80+
81+ assert type (e .value .data ).model_json_schema () == client .components .schemas ["Error" ].get_type ().model_json_schema ()
7982
8083
8184@pytest .mark .asyncio (loop_scope = "session" )
8285async def test_deletePet (server , client ):
83- r = await asyncio .to_thread (client ._ .deletePet , parameters = {"petId" : - 1 })
84- print (r )
85- assert type (r ).model_json_schema () == client .components .schemas ["Error" ].get_type ().model_json_schema ()
86+ with pytest .raises (aiopenapi3 .errors .HTTPClientError ) as e :
87+ await asyncio .to_thread (client ._ .deletePet , parameters = {"petId" : - 1 })
88+
89+ assert type (e .value .data ).model_json_schema () == client .components .schemas ["Error" ].get_type ().model_json_schema ()
8690
8791 await asyncio .to_thread (client ._ .createPet , ** randomPet (uuid .uuid4 ()))
8892 zoo = await asyncio .to_thread (client ._ .listPet )
0 commit comments