@@ -35,9 +35,9 @@ func TestValidateContent(t *testing.T) {
3535 {"NilContent" , nil , false },
3636 {"EmptyParts" , & Content {Parts : []* Part {}}, false },
3737 {"NilPart" , & Content {Parts : []* Part {nil }}, false },
38- {"EmptyTextPart" , & Content {Parts : []* Part {& Part {Text : "" }}}, false },
39- {"ValidTextPart" , & Content {Parts : []* Part {& Part {Text : "hello" }}}, true },
40- {"ValidFunctionCall" , & Content {Parts : []* Part {& Part {FunctionCall : & FunctionCall {Name : "test" }}}}, true },
38+ {"EmptyTextPart" , & Content {Parts : []* Part {{Text : "" }}}, false },
39+ {"ValidTextPart" , & Content {Parts : []* Part {{Text : "hello" }}}, true },
40+ {"ValidFunctionCall" , & Content {Parts : []* Part {{FunctionCall : & FunctionCall {Name : "test" }}}}, true },
4141 }
4242
4343 for _ , tt := range tests {
@@ -176,7 +176,6 @@ func TestChatsUnitTest(t *testing.T) {
176176 break
177177 }
178178 })
179-
180179}
181180
182181func TestChatsText (t * testing.T ) {
@@ -316,16 +315,16 @@ func TestChatsHistory(t *testing.T) {
316315 // Create a new Chat with handwritten history.
317316 var config * GenerateContentConfig = & GenerateContentConfig {Temperature : Ptr [float32 ](0.5 )}
318317 history := []* Content {
319- & Content {
318+ {
320319 Role : "user" ,
321320 Parts : []* Part {
322- & Part {Text : "What is 1 + 2?" },
321+ {Text : "What is 1 + 2?" },
323322 },
324323 },
325- & Content {
324+ {
326325 Role : "model" ,
327326 Parts : []* Part {
328- & Part {Text : "3" },
327+ {Text : "3" },
329328 },
330329 },
331330 }
@@ -721,10 +720,10 @@ data:{
721720 }
722721
723722 var expectedResponses []* Content
724- expectedResponses = append (expectedResponses , & Content {Role : "model" , Parts : []* Part {& Part {Text : "text1_candidate1" }}})
725- expectedResponses = append (expectedResponses , & Content {Role : "model" , Parts : []* Part {& Part {Text : " " }}})
726- expectedResponses = append (expectedResponses , & Content {Role : "model" , Parts : []* Part {& Part {Text : "text3_candidate1" }, & Part {Text : " additional text3_candidate1 " }}})
727- expectedResponses = append (expectedResponses , & Content {Role : "model" , Parts : []* Part {& Part {Text : "text4_candidate1" }, & Part {Text : " additional text4_candidate1" }}})
723+ expectedResponses = append (expectedResponses , & Content {Role : "model" , Parts : []* Part {{Text : "text1_candidate1" }}})
724+ expectedResponses = append (expectedResponses , & Content {Role : "model" , Parts : []* Part {{Text : " " }}})
725+ expectedResponses = append (expectedResponses , & Content {Role : "model" , Parts : []* Part {{Text : "text3_candidate1" }, {Text : " additional text3_candidate1 " }}})
726+ expectedResponses = append (expectedResponses , & Content {Role : "model" , Parts : []* Part {{Text : "text4_candidate1" }, {Text : " additional text4_candidate1" }}})
728727
729728 history := chat .History (false )
730729 expectedUserMessage := "What is 1 + 2?"
@@ -738,6 +737,5 @@ data:{
738737 }
739738 }
740739 }
741-
742740 })
743741}
0 commit comments