Skip to content

Commit 78aca4c

Browse files
committed
Fix execution import handler
1 parent aa45659 commit 78aca4c

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

utbot-python/src/main/kotlin/org/utbot/python/PythonTestGenerationProcessor.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,18 @@ object PythonTestGenerationProcessor {
144144
}
145145
}
146146
val importResultModules = notEmptyTests.flatMap { testSet ->
147-
testSet.executions.flatMap { execution ->
148-
(execution.result as UtExecutionSuccess).let { result ->
149-
(result.model as PythonModel).let {
150-
it.allContainingClassIds.map { classId ->
151-
PythonUserImport(classId.moduleName)
147+
testSet.executions.mapNotNull { execution ->
148+
if (execution.result is UtExecutionSuccess) {
149+
(execution.result as UtExecutionSuccess).let { result ->
150+
(result.model as PythonModel).let {
151+
it.allContainingClassIds.map { classId ->
152+
PythonUserImport(classId.moduleName)
153+
}
152154
}
153155
}
154156
}
155-
}
157+
else null
158+
}.flatten()
156159
}
157160
val testRootModules = notEmptyTests.mapNotNull { testSet ->
158161
methodIds[testSet.method]?.rootModuleName?.let { PythonUserImport(it) }

0 commit comments

Comments
 (0)