Skip to content

Commit 5404aaa

Browse files
committed
fix: linter
nolint : Deprecated method split function: cognitive complexity 21
1 parent 668a118 commit 5404aaa

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

fine_tunes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func (c *Client) CreateFineTune(ctx context.Context, request FineTuneRequest) (r
115115
// This API will be officially deprecated on January 4th, 2024.
116116
// OpenAI recommends to migrate to the new fine tuning API implemented in fine_tuning_job.go.
117117
func (c *Client) CancelFineTune(ctx context.Context, fineTuneID string) (response FineTune, err error) {
118-
req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/fine-tunes/"+fineTuneID+"/cancel"))
118+
req, err := c.newRequest(ctx, http.MethodPost, c.fullURL("/fine-tunes/"+fineTuneID+"/cancel")) //nolint:lll //this method is deprecated
119119
if err != nil {
120120
return
121121
}

messages_test.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,17 @@ import (
88
"testing"
99

1010
"github.com/sashabaranov/go-openai"
11+
"github.com/sashabaranov/go-openai/internal/test"
1112
"github.com/sashabaranov/go-openai/internal/test/checks"
1213
)
1314

1415
var emptyStr = ""
1516

16-
// TestMessages Tests the messages endpoint of the API using the mocked server.
17-
func TestMessages(t *testing.T) {
17+
func registerServer(t *testing.T, server *test.ServerTest) {
1818
threadID := "thread_abc123"
1919
messageID := "msg_abc123"
2020
fileID := "file_abc123"
2121

22-
client, server, teardown := setupOpenAITestServer()
23-
defer teardown()
24-
2522
server.RegisterHandler(
2623
"/v1/threads/"+threadID+"/messages/"+messageID+"/files/"+fileID,
2724
func(w http.ResponseWriter, r *http.Request) {
@@ -183,7 +180,18 @@ func TestMessages(t *testing.T) {
183180
}
184181
},
185182
)
183+
}
184+
185+
// TestMessages Tests the messages endpoint of the API using the mocked server.
186+
func TestMessages(t *testing.T) {
187+
threadID := "thread_abc123"
188+
messageID := "msg_abc123"
189+
fileID := "file_abc123"
190+
191+
client, server, teardown := setupOpenAITestServer()
192+
defer teardown()
186193

194+
registerServer(t, server)
187195
ctx := context.Background()
188196

189197
// static assertion of return type

0 commit comments

Comments
 (0)