Skip to content

Commit 0423439

Browse files
[Andrew Polyakov] Do not fuzz Union types when substituting any in ndarray
1 parent 22d461f commit 0423439

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

utbot-python/src/main/kotlin/org/utbot/python/newtyping/inference/baseline/BaselineAlgorithm.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import org.utbot.python.newtyping.utils.weightedRandom
2424
import org.utbot.python.utils.TemporaryFileManager
2525
import java.io.File
2626
import kotlin.random.Random
27+
import org.utpython.types.pythonTypeName
2728

2829
private val EDGES_TO_LINK = listOf(
2930
EdgeSource.Identification,
@@ -109,7 +110,8 @@ class BaselineAlgorithm(
109110
val laudedType = getLaudedType()
110111
if (laudedType != null) return laudedType
111112
}
112-
val randomType = getRandomType() // TODO: Not to do when ndarray (via pythonMethod )
113+
val isNDArray = pythonMethod.method.methodType.arguments.any{ it.pythonTypeName() == "numpy.ndarray" }
114+
val randomType = if (!isNDArray) { getRandomType() } else { null }
113115
if (randomType != null) return randomType
114116
}
115117

0 commit comments

Comments
 (0)