mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-12 11:43:39 +08:00
Align Go ingestion boundaries with Python (#16647)
Moves doc_id blob resolution into Parser, tightens chunker/tokenizer to Python output_format semantics, updates extractor list handling, and fixes real-template integration tests.
This commit is contained in:
31
internal/parser/parser/pdf_parser_nocgo_test.go
Normal file
31
internal/parser/parser/pdf_parser_nocgo_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
//go:build !cgo
|
||||
|
||||
package parser
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPDFParser_ParseWithResult_NoCGO(t *testing.T) {
|
||||
pdf := NewPDFParser()
|
||||
|
||||
empty := pdf.ParseWithResult("empty.pdf", nil)
|
||||
if empty.Err != nil {
|
||||
t.Fatalf("empty input: want nil err, got %v", empty.Err)
|
||||
}
|
||||
if empty.OutputFormat != "json" {
|
||||
t.Fatalf("empty input OutputFormat = %q, want json", empty.OutputFormat)
|
||||
}
|
||||
if len(empty.JSON) != 1 {
|
||||
t.Fatalf("empty input JSON len = %d, want 1", len(empty.JSON))
|
||||
}
|
||||
|
||||
res := pdf.ParseWithResult("a.pdf", []byte("%PDF-1.4"))
|
||||
if res.Err == nil {
|
||||
t.Fatal("want ErrPDFEngineUnavailable, got nil")
|
||||
}
|
||||
if !errors.Is(res.Err, ErrPDFEngineUnavailable) {
|
||||
t.Fatalf("err = %v, want wraps ErrPDFEngineUnavailable", res.Err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user