45
45
46
46
47
47
class TestConvertChatChoiceToResponseMessage :
48
- @pytest .mark .asyncio
49
48
async def test_convert_string_content (self ):
50
49
choice = OpenAIChoice (
51
50
message = OpenAIAssistantMessageParam (content = "Test message" ),
@@ -61,7 +60,6 @@ async def test_convert_string_content(self):
61
60
assert isinstance (result .content [0 ], OpenAIResponseOutputMessageContentOutputText )
62
61
assert result .content [0 ].text == "Test message"
63
62
64
- @pytest .mark .asyncio
65
63
async def test_convert_text_param_content (self ):
66
64
choice = OpenAIChoice (
67
65
message = OpenAIAssistantMessageParam (
@@ -78,12 +76,10 @@ async def test_convert_text_param_content(self):
78
76
79
77
80
78
class TestConvertResponseContentToChatContent :
81
- @pytest .mark .asyncio
82
79
async def test_convert_string_content (self ):
83
80
result = await convert_response_content_to_chat_content ("Simple string" )
84
81
assert result == "Simple string"
85
82
86
- @pytest .mark .asyncio
87
83
async def test_convert_text_content_parts (self ):
88
84
content = [
89
85
OpenAIResponseInputMessageContentText (text = "First part" ),
@@ -98,7 +94,6 @@ async def test_convert_text_content_parts(self):
98
94
assert isinstance (result [1 ], OpenAIChatCompletionContentPartTextParam )
99
95
assert result [1 ].text == "Second part"
100
96
101
- @pytest .mark .asyncio
102
97
async def test_convert_image_content (self ):
103
98
content = [OpenAIResponseInputMessageContentImage (image_url = "https://example.com/image.jpg" , detail = "high" )]
104
99
@@ -111,15 +106,13 @@ async def test_convert_image_content(self):
111
106
112
107
113
108
class TestConvertResponseInputToChatMessages :
114
- @pytest .mark .asyncio
115
109
async def test_convert_string_input (self ):
116
110
result = await convert_response_input_to_chat_messages ("User message" )
117
111
118
112
assert len (result ) == 1
119
113
assert isinstance (result [0 ], OpenAIUserMessageParam )
120
114
assert result [0 ].content == "User message"
121
115
122
- @pytest .mark .asyncio
123
116
async def test_convert_function_tool_call_output (self ):
124
117
input_items = [
125
118
OpenAIResponseInputFunctionToolCallOutput (
@@ -135,7 +128,6 @@ async def test_convert_function_tool_call_output(self):
135
128
assert result [0 ].content == "Tool output"
136
129
assert result [0 ].tool_call_id == "call_123"
137
130
138
- @pytest .mark .asyncio
139
131
async def test_convert_function_tool_call (self ):
140
132
input_items = [
141
133
OpenAIResponseOutputMessageFunctionToolCall (
@@ -154,7 +146,6 @@ async def test_convert_function_tool_call(self):
154
146
assert result [0 ].tool_calls [0 ].function .name == "test_function"
155
147
assert result [0 ].tool_calls [0 ].function .arguments == '{"param": "value"}'
156
148
157
- @pytest .mark .asyncio
158
149
async def test_convert_response_message (self ):
159
150
input_items = [
160
151
OpenAIResponseMessage (
@@ -173,22 +164,19 @@ async def test_convert_response_message(self):
173
164
174
165
175
166
class TestConvertResponseTextToChatResponseFormat :
176
- @pytest .mark .asyncio
177
167
async def test_convert_text_format (self ):
178
168
text = OpenAIResponseText (format = OpenAIResponseTextFormat (type = "text" ))
179
169
result = await convert_response_text_to_chat_response_format (text )
180
170
181
171
assert isinstance (result , OpenAIResponseFormatText )
182
172
assert result .type == "text"
183
173
184
- @pytest .mark .asyncio
185
174
async def test_convert_json_object_format (self ):
186
175
text = OpenAIResponseText (format = {"type" : "json_object" })
187
176
result = await convert_response_text_to_chat_response_format (text )
188
177
189
178
assert isinstance (result , OpenAIResponseFormatJSONObject )
190
179
191
- @pytest .mark .asyncio
192
180
async def test_convert_json_schema_format (self ):
193
181
schema_def = {"type" : "object" , "properties" : {"test" : {"type" : "string" }}}
194
182
text = OpenAIResponseText (
@@ -204,7 +192,6 @@ async def test_convert_json_schema_format(self):
204
192
assert result .json_schema ["name" ] == "test_schema"
205
193
assert result .json_schema ["schema" ] == schema_def
206
194
207
- @pytest .mark .asyncio
208
195
async def test_default_text_format (self ):
209
196
text = OpenAIResponseText ()
210
197
result = await convert_response_text_to_chat_response_format (text )
@@ -214,27 +201,22 @@ async def test_default_text_format(self):
214
201
215
202
216
203
class TestGetMessageTypeByRole :
217
- @pytest .mark .asyncio
218
204
async def test_user_role (self ):
219
205
result = await get_message_type_by_role ("user" )
220
206
assert result == OpenAIUserMessageParam
221
207
222
- @pytest .mark .asyncio
223
208
async def test_system_role (self ):
224
209
result = await get_message_type_by_role ("system" )
225
210
assert result == OpenAISystemMessageParam
226
211
227
- @pytest .mark .asyncio
228
212
async def test_assistant_role (self ):
229
213
result = await get_message_type_by_role ("assistant" )
230
214
assert result == OpenAIAssistantMessageParam
231
215
232
- @pytest .mark .asyncio
233
216
async def test_developer_role (self ):
234
217
result = await get_message_type_by_role ("developer" )
235
218
assert result == OpenAIDeveloperMessageParam
236
219
237
- @pytest .mark .asyncio
238
220
async def test_unknown_role (self ):
239
221
result = await get_message_type_by_role ("unknown" )
240
222
assert result is None
0 commit comments