boolean (@NotNull final Location location) { final Module module = location.getModule(); if (!isPythonModule(module)) return false; final PsiElement element = location.getPsiElement(); if (element instanceof PsiFile) { final PyDocTestVisitor visitor = new PyDocTestVisitor(); element.accept(visitor); return visitor.hasTests; } else return true; }