String () { final PsiElementProcessor.FindElement<PsiElement> processor = new PsiElementProcessor.FindElement<>() { @Override public boolean execute(@NotNull PsiElement element) { if (element instanceof PyStringLiteralExpression && element.getFirstChild().getNode().getElementType() == PyTokenTypes.DOCSTRING) { return setFound(element); } return true; } }; PsiTreeUtil.processElements(myFixture.getFile(), processor); if (!processor.isFound()) { return null; } final PsiElement foundElement = processor.getFoundElement(); assertNotNull(foundElement); return ((PyStringLiteralExpression)foundElement).getStringValue(); }