@@ -66,15 +66,15 @@ func TestRetryAfter(t *testing.T) {
66
66
},
67
67
}),
68
68
)
69
- res , err := client .Chat .Completions .New (context .Background (), openai.ChatCompletionNewParams {
69
+ _ , err := client .Chat .Completions .New (context .Background (), openai.ChatCompletionNewParams {
70
70
Messages : openai .F ([]openai.ChatCompletionMessageParamUnion {openai.ChatCompletionUserMessageParam {
71
71
Role : openai .F (openai .ChatCompletionUserMessageParamRoleUser ),
72
72
Content : openai .F ([]openai.ChatCompletionContentPartUnionParam {openai.ChatCompletionContentPartTextParam {Text : openai .F ("text" ), Type : openai .F (openai .ChatCompletionContentPartTextTypeText )}}),
73
73
}}),
74
74
Model : openai .F (openai .ChatModelO1 ),
75
75
})
76
- if err == nil || res != nil {
77
- t .Error ("Expected there to be a cancel error and for the response to be nil " )
76
+ if err == nil {
77
+ t .Error ("Expected there to be a cancel error" )
78
78
}
79
79
80
80
attempts := len (retryCountHeaders )
@@ -106,15 +106,15 @@ func TestDeleteRetryCountHeader(t *testing.T) {
106
106
}),
107
107
option .WithHeaderDel ("X-Stainless-Retry-Count" ),
108
108
)
109
- res , err := client .Chat .Completions .New (context .Background (), openai.ChatCompletionNewParams {
109
+ _ , err := client .Chat .Completions .New (context .Background (), openai.ChatCompletionNewParams {
110
110
Messages : openai .F ([]openai.ChatCompletionMessageParamUnion {openai.ChatCompletionUserMessageParam {
111
111
Role : openai .F (openai .ChatCompletionUserMessageParamRoleUser ),
112
112
Content : openai .F ([]openai.ChatCompletionContentPartUnionParam {openai.ChatCompletionContentPartTextParam {Text : openai .F ("text" ), Type : openai .F (openai .ChatCompletionContentPartTextTypeText )}}),
113
113
}}),
114
114
Model : openai .F (openai .ChatModelO1 ),
115
115
})
116
- if err == nil || res != nil {
117
- t .Error ("Expected there to be a cancel error and for the response to be nil " )
116
+ if err == nil {
117
+ t .Error ("Expected there to be a cancel error" )
118
118
}
119
119
120
120
expectedRetryCountHeaders := []string {"" , "" , "" }
@@ -141,15 +141,15 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
141
141
}),
142
142
option .WithHeader ("X-Stainless-Retry-Count" , "42" ),
143
143
)
144
- res , err := client .Chat .Completions .New (context .Background (), openai.ChatCompletionNewParams {
144
+ _ , err := client .Chat .Completions .New (context .Background (), openai.ChatCompletionNewParams {
145
145
Messages : openai .F ([]openai.ChatCompletionMessageParamUnion {openai.ChatCompletionUserMessageParam {
146
146
Role : openai .F (openai .ChatCompletionUserMessageParamRoleUser ),
147
147
Content : openai .F ([]openai.ChatCompletionContentPartUnionParam {openai.ChatCompletionContentPartTextParam {Text : openai .F ("text" ), Type : openai .F (openai .ChatCompletionContentPartTextTypeText )}}),
148
148
}}),
149
149
Model : openai .F (openai .ChatModelO1 ),
150
150
})
151
- if err == nil || res != nil {
152
- t .Error ("Expected there to be a cancel error and for the response to be nil " )
151
+ if err == nil {
152
+ t .Error ("Expected there to be a cancel error" )
153
153
}
154
154
155
155
expectedRetryCountHeaders := []string {"42" , "42" , "42" }
@@ -175,15 +175,15 @@ func TestRetryAfterMs(t *testing.T) {
175
175
},
176
176
}),
177
177
)
178
- res , err := client .Chat .Completions .New (context .Background (), openai.ChatCompletionNewParams {
178
+ _ , err := client .Chat .Completions .New (context .Background (), openai.ChatCompletionNewParams {
179
179
Messages : openai .F ([]openai.ChatCompletionMessageParamUnion {openai.ChatCompletionUserMessageParam {
180
180
Role : openai .F (openai .ChatCompletionUserMessageParamRoleUser ),
181
181
Content : openai .F ([]openai.ChatCompletionContentPartUnionParam {openai.ChatCompletionContentPartTextParam {Text : openai .F ("text" ), Type : openai .F (openai .ChatCompletionContentPartTextTypeText )}}),
182
182
}}),
183
183
Model : openai .F (openai .ChatModelO1 ),
184
184
})
185
- if err == nil || res != nil {
186
- t .Error ("Expected there to be a cancel error and for the response to be nil " )
185
+ if err == nil {
186
+ t .Error ("Expected there to be a cancel error" )
187
187
}
188
188
if want := 3 ; attempts != want {
189
189
t .Errorf ("Expected %d attempts, got %d" , want , attempts )
@@ -203,15 +203,15 @@ func TestContextCancel(t *testing.T) {
203
203
)
204
204
cancelCtx , cancel := context .WithCancel (context .Background ())
205
205
cancel ()
206
- res , err := client .Chat .Completions .New (cancelCtx , openai.ChatCompletionNewParams {
206
+ _ , err := client .Chat .Completions .New (cancelCtx , openai.ChatCompletionNewParams {
207
207
Messages : openai .F ([]openai.ChatCompletionMessageParamUnion {openai.ChatCompletionUserMessageParam {
208
208
Role : openai .F (openai .ChatCompletionUserMessageParamRoleUser ),
209
209
Content : openai .F ([]openai.ChatCompletionContentPartUnionParam {openai.ChatCompletionContentPartTextParam {Text : openai .F ("text" ), Type : openai .F (openai .ChatCompletionContentPartTextTypeText )}}),
210
210
}}),
211
211
Model : openai .F (openai .ChatModelO1 ),
212
212
})
213
- if err == nil || res != nil {
214
- t .Error ("Expected there to be a cancel error and for the response to be nil " )
213
+ if err == nil {
214
+ t .Error ("Expected there to be a cancel error" )
215
215
}
216
216
}
217
217
@@ -228,15 +228,15 @@ func TestContextCancelDelay(t *testing.T) {
228
228
)
229
229
cancelCtx , cancel := context .WithTimeout (context .Background (), 2 * time .Millisecond )
230
230
defer cancel ()
231
- res , err := client .Chat .Completions .New (cancelCtx , openai.ChatCompletionNewParams {
231
+ _ , err := client .Chat .Completions .New (cancelCtx , openai.ChatCompletionNewParams {
232
232
Messages : openai .F ([]openai.ChatCompletionMessageParamUnion {openai.ChatCompletionUserMessageParam {
233
233
Role : openai .F (openai .ChatCompletionUserMessageParamRoleUser ),
234
234
Content : openai .F ([]openai.ChatCompletionContentPartUnionParam {openai.ChatCompletionContentPartTextParam {Text : openai .F ("text" ), Type : openai .F (openai .ChatCompletionContentPartTextTypeText )}}),
235
235
}}),
236
236
Model : openai .F (openai .ChatModelO1 ),
237
237
})
238
- if err == nil || res != nil {
239
- t .Error ("expected there to be a cancel error and for the response to be nil " )
238
+ if err == nil {
239
+ t .Error ("expected there to be a cancel error" )
240
240
}
241
241
}
242
242
@@ -259,15 +259,15 @@ func TestContextDeadline(t *testing.T) {
259
259
},
260
260
}),
261
261
)
262
- res , err := client .Chat .Completions .New (deadlineCtx , openai.ChatCompletionNewParams {
262
+ _ , err := client .Chat .Completions .New (deadlineCtx , openai.ChatCompletionNewParams {
263
263
Messages : openai .F ([]openai.ChatCompletionMessageParamUnion {openai.ChatCompletionUserMessageParam {
264
264
Role : openai .F (openai .ChatCompletionUserMessageParamRoleUser ),
265
265
Content : openai .F ([]openai.ChatCompletionContentPartUnionParam {openai.ChatCompletionContentPartTextParam {Text : openai .F ("text" ), Type : openai .F (openai .ChatCompletionContentPartTextTypeText )}}),
266
266
}}),
267
267
Model : openai .F (openai .ChatModelO1 ),
268
268
})
269
- if err == nil || res != nil {
270
- t .Error ("expected there to be a deadline error and for the response to be nil " )
269
+ if err == nil {
270
+ t .Error ("expected there to be a deadline error" )
271
271
}
272
272
close (testDone )
273
273
}()
0 commit comments