use of com.jetbrains.python.psi.stubs.PyNamedTupleStub in project intellij-community by JetBrains.
the class PyStubsTest method doTestNamedTuple.
private void doTestNamedTuple(@NotNull String expectedName, @NotNull List<String> expectedFields, @NotNull QualifiedName expectedCalleeName) {
final PyFile file = getTestFile();
final PyTargetExpression attribute = file.findTopLevelAttribute("nt");
assertNotNull(attribute);
final PyNamedTupleStub stub = attribute.getStub().getCustomStub(PyNamedTupleStub.class);
assertNotNull(stub);
assertEquals(expectedCalleeName, stub.getCalleeName());
final PyType typeFromStub = TypeEvalContext.codeInsightFallback(myFixture.getProject()).getType(attribute);
doTestNamedTuple(expectedName, expectedFields, typeFromStub);
assertNotParsed(file);
final FileASTNode astNode = file.getNode();
assertNotNull(astNode);
final PyType typeFromAst = TypeEvalContext.userInitiated(myFixture.getProject(), file).getType(attribute);
doTestNamedTuple(expectedName, expectedFields, typeFromAst);
}
Aggregations