PsiNamedElement (String name) { final Project project = myFixture.getProject(); final GlobalSearchScope scope = ProjectScope.getProjectScope(project); final Collection<PyClass> classes = PyClassNameIndex.find(name, project, scope); if (classes.size() > 0) { return classes.iterator().next(); } final Collection<PyFunction> functions = PyFunctionNameIndex.find(name, project, scope); if (functions.size() > 0) { return functions.iterator().next(); } final Collection<PyTargetExpression> targets = PyVariableNameIndex.find(name, project, scope); if (targets.size() > 0) { return targets.iterator().next(); } return null; }