use of com.jetbrains.python.psi.PySubscriptionExpression in project intellij-community by JetBrains.
the class PyAssignmentMappingTest method testSubscribedTarget.
public void testSubscribedTarget() throws Exception {
Map<String, PsiElement> marks = loadTest();
Assert.assertEquals(2, marks.size());
// const -> expr;
PsiElement src = marks.get("<src>").getParent();
// ident -> target expr
PsiElement dst = marks.get("<dst>").getParent().getParent();
Assert.assertTrue(dst instanceof PySubscriptionExpression);
PyAssignmentStatement stmt = (PyAssignmentStatement) src.getParent();
List<Pair<PyExpression, PyExpression>> mapping = stmt.getTargetsToValuesMapping();
Assert.assertEquals(1, mapping.size());
Pair<PyExpression, PyExpression> pair = mapping.get(0);
Assert.assertEquals(dst, pair.getFirst());
Assert.assertEquals(src, pair.getSecond());
}
Aggregations