boolean (@NotNull final PsiElement element, @Nullable final TypeEvalContext context) { final PyFunction fun = PsiTreeUtil.getParentOfType(element, PyFunction.class, false); if (fun != null) { if (isTestFunction(fun, ThreeState.UNSURE, context)) { return true; } } final PyClass clazz = PsiTreeUtil.getParentOfType(element, PyClass.class, false); if (clazz != null && isTestClass(clazz, ThreeState.UNSURE, context)) { return true; } return element instanceof PyFile && isTestFile((PyFile)element, ThreeState.UNSURE, context); }