Merge pull request #1097 from trheyi/main

Add tests for Structured and Semantic schema retrieval
This commit is contained in:
Max 2025-08-10 17:21:49 +08:00 committed by GitHub
commit 9be07f8482
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 46 additions and 24 deletions

View file

@ -400,3 +400,25 @@ func TestSemantic_Options(t *testing.T) {
}
})
}
func TestStructured_Schema(t *testing.T) {
s := &Structured{}
schema, err := s.Schema(nil, "en")
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}
func TestSemantic_Schema(t *testing.T) {
s := &Semantic{}
schema, err := s.Schema(nil, "en")
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -224,7 +224,7 @@ func TestMCP_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -401,7 +401,7 @@ func TestOCR_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -307,7 +307,7 @@ func TestOffice_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -125,7 +125,7 @@ func TestUTF8_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -248,7 +248,7 @@ func TestVideo_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -186,7 +186,7 @@ func TestVision_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -217,7 +217,7 @@ func TestWhisper_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -126,8 +126,8 @@ func TestOpenAI_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}
@ -287,7 +287,7 @@ func TestFastembed_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -283,7 +283,7 @@ func TestExtractorOpenAI_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}

View file

@ -187,8 +187,8 @@ func TestFetcherHTTP_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}
@ -445,7 +445,7 @@ func TestFetcherMCP_Schema(t *testing.T) {
if err != nil {
t.Errorf("Expected no error, got %v", err)
}
if schema != nil {
t.Error("Expected nil schema")
if schema == nil {
t.Error("Expected non-nil schema from factory.GetSchemaFromBindata")
}
}