From 1e5b81802c4fbc95d2a4a25acab97918244d0bce Mon Sep 17 00:00:00 2001 From: Kazik Pogoda Date: Tue, 15 Oct 2024 17:03:43 +0200 Subject: [PATCH] fix to relax structured output test --- src/jvmTest/kotlin/StructuredOutputTest.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/jvmTest/kotlin/StructuredOutputTest.kt b/src/jvmTest/kotlin/StructuredOutputTest.kt index 69fceca..e306dc9 100644 --- a/src/jvmTest/kotlin/StructuredOutputTest.kt +++ b/src/jvmTest/kotlin/StructuredOutputTest.kt @@ -6,6 +6,7 @@ import com.xemantic.anthropic.tool.UsableTool import io.kotest.assertions.assertSoftly import io.kotest.matchers.collections.shouldHaveSize import io.kotest.matchers.shouldBe +import io.kotest.matchers.string.shouldStartWith import kotlinx.coroutines.test.runTest import kotlinx.serialization.Serializable import kotlin.test.Test @@ -70,7 +71,9 @@ class StructuredOutputTest { report.assets shouldHaveSize 6 assertSoftly(report.assets[0]) { - assetName shouldBe "11 Zinfandel Lane - Home & Vineyard [RP]" + // it seems that sometimes the model is not returning content in square brackets + // so we are going for shouldStartWith + assetName shouldStartWith "11 Zinfandel Lane - Home & Vineyard" owner shouldBe "JT" location shouldBe "St. Helena/Napa, CA, US" assetValueLow shouldBe 5000001 @@ -81,7 +84,7 @@ class StructuredOutputTest { txGt1000 shouldBe false } assertSoftly(report.assets[1]) { - assetName shouldBe "25 Point Lobos - Commercial Property [RP]" + assetName shouldStartWith "25 Point Lobos - Commercial Property" owner shouldBe "SP" location shouldBe "San Francisco/San Francisco, CA, US" assetValueLow shouldBe 5000001