use of com.jetbrains.python.psi.PyClass in project intellij-community by JetBrains.
the class PyControlFlowBuilderTest method testQualifiedSelfReference.
public void testQualifiedSelfReference() {
final String testName = getTestName(false).toLowerCase();
configureByFile(testName + ".py");
final String fullPath = getTestDataPath() + testName + ".txt";
final PyClass pyClass = ((PyFile) myFile).getTopLevelClasses().get(0);
final ControlFlow flow = ControlFlowCache.getControlFlow(pyClass.getMethods()[0]);
check(fullPath, flow);
}
use of com.jetbrains.python.psi.PyClass in project intellij-community by JetBrains.
the class PyClassMROTest method testTangledInheritance.
public void testTangledInheritance() {
final int numClasses = 100;
final List<String> expectedMRO = new ArrayList<>();
for (int i = numClasses - 1; i >= 1; i--) {
expectedMRO.add(String.format("Class%03d", i));
}
expectedMRO.add("object");
final PyClass pyClass = getClass(String.format("Class%03d", numClasses));
final long startTime = System.currentTimeMillis();
assertMRO(pyClass, ArrayUtil.toStringArray(expectedMRO));
final long elapsed = System.currentTimeMillis() - startTime;
assertTrue("Calculation of MRO takes too much time: " + elapsed + " ms", elapsed < 1000);
}
use of com.jetbrains.python.psi.PyClass in project intellij-community by JetBrains.
the class PyClassMROTest method getClass.
@NotNull
public PyClass getClass(@NotNull String name) {
myFixture.configureByFile(getPath(getTestName(false)));
final PyClass cls = myFixture.findElementByText(name, PyClass.class);
assertNotNull(cls);
return cls;
}
Aggregations