test(memory): PG 索引的 Vectors 读口纳入 DB_PG_URL 真库往返断言(M61)
This commit is contained in:
1 parent
589e26c887
commit
8f7017fc0b
1 file changed
+19
@@ -89,4 +89,23 @@ func TestPG_RequiresEnv(t *testing.T) {
|
||||
if len(vs) != 1 || len(vs[0]) != 4 {
|
||||
t.Fatalf("Embed => %d vectors, want one 4-dim", len(vs))
|
||||
}
|
||||
|
||||
// Vectors(增量向量化的读口):命中按位置给出,未命中为 nil ——
|
||||
// 这条断言顺带验 vector::text 的解析在真实 pgvector 上成立。
|
||||
got, err := idx.Vectors(ctx, []string{"b", "missing", "a"})
|
||||
if err != nil {
|
||||
t.Fatalf("Vectors: %v", err)
|
||||
}
|
||||
if len(got) != 3 {
|
||||
t.Fatalf("Vectors 返回 %d 条, want 3", len(got))
|
||||
}
|
||||
if !equalVector(got[0], Vector{0, 1, 0, 0}) {
|
||||
t.Fatalf("Vectors[0] = %v, want b 的向量", got[0])
|
||||
}
|
||||
if len(got[1]) != 0 {
|
||||
t.Fatalf("未命中的 id 返回了向量:%v", got[1])
|
||||
}
|
||||
if !equalVector(got[2], Vector{1, 0, 0, 0}) {
|
||||
t.Fatalf("Vectors[2] = %v, want a 的向量", got[2])
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user