void (boolean hasErrors) { String inputDataFileName = getTestName(true) + ".py"; myFixture.configureByFile(inputDataFileName); final InjectedLanguageManager languageManager = InjectedLanguageManager.getInstance(myFixture.getProject()); final PsiLanguageInjectionHost host = languageManager.getInjectionHost(myFixture.getElementAtCaret()); assertNotNull(host); final List<Pair<PsiElement,TextRange>> files = languageManager.getInjectedPsiFiles(host); assertNotNull(files); for (Pair<PsiElement,TextRange> pair : files) { assertEquals(hasErrors, PsiTreeUtil.hasErrorElements(pair.getFirst())); } }