@@ -15,13 +15,6 @@ import (
15
15
"github.com/sashabaranov/go-openai/internal/test/checks"
16
16
)
17
17
18
- // badMarshaler produces invalid JSON when marshaled.
19
- type badMarshaler struct {}
20
-
21
- func (badMarshaler ) MarshalJSON () ([]byte , error ) {
22
- return []byte ("{" ), nil
23
- }
24
-
25
18
func TestEmbedding (t * testing.T ) {
26
19
embeddedModels := []openai.EmbeddingModel {
27
20
openai .AdaSimilarity ,
@@ -332,21 +325,3 @@ func TestDotProduct(t *testing.T) {
332
325
t .Errorf ("Expected Vector Length Mismatch Error, but got: %v" , err )
333
326
}
334
327
}
335
-
336
- // TestCreateEmbeddings_UnmarshalError verifies that an error is returned when
337
- // the JSON bytes produced by marshaling the request cannot be unmarshaled back
338
- // into a map.
339
- func TestCreateEmbeddings_UnmarshalError (t * testing.T ) {
340
- client , server , teardown := setupOpenAITestServer ()
341
- defer teardown ()
342
-
343
- server .RegisterHandler ("/v1/embeddings" , func (w http.ResponseWriter , _ * http.Request ) {
344
- w .WriteHeader (http .StatusOK )
345
- fmt .Fprint (w , `{"data":[]}` )
346
- })
347
-
348
- _ , err := client .CreateEmbeddings (context .Background (), openai.EmbeddingRequest {
349
- Input : badMarshaler {},
350
- })
351
- checks .HasError (t , err , "CreateEmbeddings should fail on unmarshal error" )
352
- }
0 commit comments