fix
This commit is contained in:
@@ -80,29 +80,35 @@ func TestSynthesizeDescriptionFromTitle_brandModelCategory(t *testing.T) {
|
||||
}
|
||||
en := synthesizeDescriptionFromTitle(title, "TV Mounts", "en", attrs)
|
||||
if en == "" {
|
||||
t.Fatal("expected nonempty English invent")
|
||||
t.Fatal("expected nonempty English factual fallback")
|
||||
}
|
||||
if strings.Contains(strings.ToLower(en), "ready for retail listing") {
|
||||
t.Fatalf("must not emit retail filler: %q", en)
|
||||
}
|
||||
if strings.Contains(strings.ToLower(en), "is a ") && strings.Contains(strings.ToLower(en), " product from ") {
|
||||
t.Fatalf("must not emit invent boilerplate: %q", en)
|
||||
}
|
||||
for _, need := range []string{"Vogel", "TV Mounts", "45 cm", "40 kg"} {
|
||||
if !strings.Contains(en, need) {
|
||||
t.Fatalf("English invent missing %q: %q", need, en)
|
||||
t.Fatalf("English fallback missing %q: %q", need, en)
|
||||
}
|
||||
}
|
||||
if isWeakPriorEnhanceDescription(en, title) {
|
||||
t.Fatalf("factual invent must not be weak: %q", en)
|
||||
t.Fatalf("factual fallback must not be weak: %q", en)
|
||||
}
|
||||
|
||||
sl := synthesizeDescriptionFromTitle(title, "TV Mounts", "sl", attrs)
|
||||
if sl == "" || !strings.Contains(sl, "kategoriji") {
|
||||
t.Fatalf("expected Slovenian invent, got %q", sl)
|
||||
if sl == "" || !strings.Contains(sl, "znamka") {
|
||||
t.Fatalf("expected Slovenian factual fallback, got %q", sl)
|
||||
}
|
||||
if strings.Contains(strings.ToLower(sl), "je izdelek v kategoriji") {
|
||||
t.Fatalf("must not emit invent boilerplate: %q", sl)
|
||||
}
|
||||
if strings.Contains(strings.ToLower(sl), "ready for retail listing") {
|
||||
t.Fatalf("SL invent must not emit EN filler: %q", sl)
|
||||
t.Fatalf("SL fallback must not emit EN filler: %q", sl)
|
||||
}
|
||||
if isWeakPriorEnhanceDescription(sl, title) {
|
||||
t.Fatalf("SL factual invent must not be weak: %q", sl)
|
||||
t.Fatalf("SL factual fallback must not be weak: %q", sl)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +140,7 @@ func TestInventHeuristicDescription_fromBrandModelCategory(t *testing.T) {
|
||||
|
||||
slSystem := "Write name and description in Slovenian. Return JSON with \"name\"."
|
||||
sl := inventHeuristicDescription(slSystem, user, title)
|
||||
if !strings.Contains(sl, "kategoriji") {
|
||||
t.Fatalf("expected SL invent from system language, got %q", sl)
|
||||
if !strings.Contains(sl, "znamka") {
|
||||
t.Fatalf("expected SL factual invent from system language, got %q", sl)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user