Search in sources :

Example 11 with PyFileImpl

use of com.jetbrains.python.psi.impl.PyFileImpl in project intellij-community by JetBrains.

the class PyOptimizeImportsTest method testExtractImportBlockWithIntermediateComments.

public void testExtractImportBlockWithIntermediateComments() {
    myFixture.configureByFile(getTestName(true) + ".py");
    final PyFileImpl file = assertInstanceOf(myFixture.getFile(), PyFileImpl.class);
    final List<PyImportStatementBase> block = file.getImportBlock();
    assertSize(2, block);
}
Also used : PyImportStatementBase(com.jetbrains.python.psi.PyImportStatementBase) PyFileImpl(com.jetbrains.python.psi.impl.PyFileImpl)

Example 12 with PyFileImpl

use of com.jetbrains.python.psi.impl.PyFileImpl in project intellij-community by JetBrains.

the class PyStubsTest method testNameInExcept.

public void testNameInExcept() {
    final PyFileImpl file = (PyFileImpl) getTestFile();
    final PsiElement element = file.findExportedName("md5");
    assertTrue(element != null ? element.toString() : "null", element instanceof PyTargetExpression);
    assertNotParsed(file);
}
Also used : PyFileImpl(com.jetbrains.python.psi.impl.PyFileImpl)

Example 13 with PyFileImpl

use of com.jetbrains.python.psi.impl.PyFileImpl in project intellij-community by JetBrains.

the class PyStubsTest method testAugAssignDunderAll.

public void testAugAssignDunderAll() {
    final PyFileImpl file = (PyFileImpl) getTestFile();
    final List<String> all = file.getDunderAll();
    assertNull(all);
    assertNotParsed(file);
}
Also used : PyFileImpl(com.jetbrains.python.psi.impl.PyFileImpl)

Example 14 with PyFileImpl

use of com.jetbrains.python.psi.impl.PyFileImpl in project intellij-community by JetBrains.

the class PyStubsTest method testWrappedStaticMethod.

public void testWrappedStaticMethod() {
    final PyFileImpl file = (PyFileImpl) getTestFile();
    final PyClass pyClass = file.getTopLevelClasses().get(0);
    final PyFunction[] methods = pyClass.getMethods();
    assertEquals(1, methods.length);
    final PyFunction.Modifier modifier = methods[0].getModifier();
    assertEquals(PyFunction.Modifier.STATICMETHOD, modifier);
    assertNotParsed(file);
}
Also used : PyFileImpl(com.jetbrains.python.psi.impl.PyFileImpl)

Example 15 with PyFileImpl

use of com.jetbrains.python.psi.impl.PyFileImpl in project intellij-community by JetBrains.

the class PyStubsTest method testDynamicDunderAll.

public void testDynamicDunderAll() {
    final PyFileImpl file = (PyFileImpl) getTestFile();
    final List<String> all = file.getDunderAll();
    assertNull(all);
    assertNotParsed(file);
}
Also used : PyFileImpl(com.jetbrains.python.psi.impl.PyFileImpl)

Aggregations

PyFileImpl (com.jetbrains.python.psi.impl.PyFileImpl)17 PyImportStatementBase (com.jetbrains.python.psi.PyImportStatementBase)2 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)1 InspectionProfile (com.intellij.codeInspection.InspectionProfile)1 Result (com.intellij.openapi.application.Result)1 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)1 CommonCodeStyleSettings (com.intellij.psi.codeStyle.CommonCodeStyleSettings)1 StubElement (com.intellij.psi.stubs.StubElement)1 QualifiedName (com.intellij.psi.util.QualifiedName)1 PyCodeStyleSettings (com.jetbrains.python.formatter.PyCodeStyleSettings)1 PyPep8Inspection (com.jetbrains.python.inspections.PyPep8Inspection)1 Nullable (org.jetbrains.annotations.Nullable)1