File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
utbot-python/src/main/kotlin/org/utbot/python Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -235,17 +235,18 @@ abstract class PythonTestGenerationProcessor {
235235 var containingClass: CompositeType ? = null
236236 val containingClassName = method.containingPythonClassId?.simpleName
237237 val definition = if (containingClassName == null ) {
238- mypyStorage.definitions[curModule]!! [ method.name] !! .getUtBotDefinition()!!
238+ mypyStorage.definitions[curModule]?.get( method.name)? .getUtBotDefinition()
239239 } else {
240240 containingClass =
241- mypyStorage.definitions[curModule]!! [containingClassName]!! .getUtBotType() as CompositeType
241+ mypyStorage.definitions[curModule]?.get(containingClassName)?.getUtBotType() as ? CompositeType
242+ ? : throw SelectedMethodIsNotAFunctionDefinition (method.name)
242243 val descr = containingClass.pythonDescription()
243244 if (descr !is PythonConcreteCompositeTypeDescription )
244245 throw SelectedMethodIsNotAFunctionDefinition (method.name)
245- mypyStorage.definitions[curModule]!! [ containingClassName] !! .type.asUtBotType.getPythonAttributes().first {
246+ mypyStorage.definitions[curModule]?.get( containingClassName)? .type? .asUtBotType? .getPythonAttributes()? .first {
246247 it.meta.name == method.name
247248 }
248- }
249+ } ? : throw SelectedMethodIsNotAFunctionDefinition (method.name)
249250 val parsedFile = PythonParser (sourceFileContent).Module ()
250251 val funcDef = PythonCode .findFunctionDefinition(parsedFile, method)
251252 val decorators = funcDef.decorators.map { PyDecorator .decoratorByName(it.name.toString()) }
You can’t perform that action at this time.
0 commit comments