PyCallExpression (final LanguageLevel langLevel, String functionName) { final PsiFile dummyFile = createDummyFile(langLevel, functionName + "()"); final PsiElement child = dummyFile.getFirstChild(); if (child != null) { final PsiElement element = child.getFirstChild(); if (element instanceof PyCallExpression) { return (PyCallExpression)element; } } throw new IllegalArgumentException("Invalid call expression text " + functionName); }