From 81a0ab2428ac5beeacd7ce5bf12abea7cfaf8f25 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tamarin Date: Thu, 23 Mar 2023 13:19:31 +0300 Subject: [PATCH 1/3] Fix string summary --- .../utbot/python/fuzzing/provider/utils/SummaryGeneration.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/utils/SummaryGeneration.kt b/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/utils/SummaryGeneration.kt index 1b3bb9c259..674921d707 100644 --- a/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/utils/SummaryGeneration.kt +++ b/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/utils/SummaryGeneration.kt @@ -1,12 +1,12 @@ package org.utbot.python.fuzzing.provider.utils import org.utbot.fuzzing.seeds.BitVectorValue -import org.utbot.fuzzing.seeds.Bool import org.utbot.fuzzing.seeds.DefaultFloatBound import org.utbot.fuzzing.seeds.IEEE754Value import org.utbot.fuzzing.seeds.KnownValue import org.utbot.fuzzing.seeds.Signed import org.utbot.fuzzing.seeds.StringValue +import org.utbot.python.framework.codegen.toPythonRawString fun T.valueToString(): String { when (this) { @@ -34,6 +34,9 @@ fun T.valueToString(): String { } } is StringValue -> { + if (value.contains("\"\"\"")) { + return value.toPythonRawString() + } return "'$value'" } else -> return toString() From fa55ebac1d969a072f1f307bf5b12c6b2d792f7c Mon Sep 17 00:00:00 2001 From: Vyacheslav Tamarin Date: Thu, 23 Mar 2023 13:19:54 +0300 Subject: [PATCH 2/3] Fix empty tuple --- .../python/fuzzing/provider/TupleFixSizeValueProvider.kt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/TupleFixSizeValueProvider.kt b/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/TupleFixSizeValueProvider.kt index 3b755d0fdc..8725345ae3 100644 --- a/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/TupleFixSizeValueProvider.kt +++ b/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/TupleFixSizeValueProvider.kt @@ -33,10 +33,7 @@ object TupleFixSizeValueProvider : ValueProvider().toMutableMap()), - "%var% = ${type.pythonTypeRepresentation()}" - )} + empty = Routine.Empty { PythonFuzzedValue(PythonTree.FakeNode) } )) } } \ No newline at end of file From 42b4e4dbad623c9d0077d3c1f3d1ea4d215acb03 Mon Sep 17 00:00:00 2001 From: Vyacheslav Tamarin Date: Thu, 23 Mar 2023 17:23:10 +0300 Subject: [PATCH 3/3] Fix string """ in documentation before test --- .../utbot/python/fuzzing/provider/utils/SummaryGeneration.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/utils/SummaryGeneration.kt b/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/utils/SummaryGeneration.kt index 674921d707..aaff31ea5b 100644 --- a/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/utils/SummaryGeneration.kt +++ b/utbot-python/src/main/kotlin/org/utbot/python/fuzzing/provider/utils/SummaryGeneration.kt @@ -6,7 +6,6 @@ import org.utbot.fuzzing.seeds.IEEE754Value import org.utbot.fuzzing.seeds.KnownValue import org.utbot.fuzzing.seeds.Signed import org.utbot.fuzzing.seeds.StringValue -import org.utbot.python.framework.codegen.toPythonRawString fun T.valueToString(): String { when (this) { @@ -35,7 +34,8 @@ fun T.valueToString(): String { } is StringValue -> { if (value.contains("\"\"\"")) { - return value.toPythonRawString() + val newValue = value.replace("\"", "\\\"") + return "'$newValue'" } return "'$value'" }