Add tests for Structured and Semantic schema retrieval
- Introduced new test cases for Structured and Semantic providers to validate schema retrieval functionality. - Updated existing tests across various providers to ensure they check for non-nil schemas, enhancing error handling and test coverage. - Ensured consistency in error messages for schema validation across different provider tests.
This commit is contained in:
parent
eb1bf43d61
commit
d750365ed9
11 changed files with 46 additions and 24 deletions
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue