diff --git a/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/constructor/tree/PythonCgMethodConstructor.kt b/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/constructor/tree/PythonCgMethodConstructor.kt index f1faa03a53..b9c143b4b1 100644 --- a/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/constructor/tree/PythonCgMethodConstructor.kt +++ b/utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model/constructor/tree/PythonCgMethodConstructor.kt @@ -62,7 +62,7 @@ class PythonCgMethodConstructor(context: CgContext) : CgMethodConstructor(contex val afterThisInstance = execution.stateAfter.thisInstance val assertThisObject = emptyList>().toMutableList() if (beforeThisInstance is PythonTreeModel && afterThisInstance is PythonTreeModel) { - if (beforeThisInstance != afterThisInstance) { + if (PythonTreeWrapper(beforeThisInstance.tree) != PythonTreeWrapper(afterThisInstance.tree)) { thisInstance = thisInstance?.let { val newValue = if (it is CgPythonTree) { @@ -91,7 +91,7 @@ class PythonCgMethodConstructor(context: CgContext) : CgMethodConstructor(contex val afterValue = execution.stateAfter.parameters[index] if (afterValue is PythonTreeModel && param is PythonTreeModel) { - if (afterValue != param) { + if (PythonTreeWrapper(afterValue.tree) != PythonTreeWrapper(param.tree)) { if (argument !is CgVariable) { argument = newVar(argument.type, name) {argument} }