use of com.jetbrains.python.psi.impl.PyPathEvaluator in project intellij-community by JetBrains.
the class PyPathEvaluatorTest method testList.
public void testList() {
final PyExpression expression = PyElementGenerator.getInstance(myFixture.getProject()).createExpressionFromText("['a' + 'b'] + ['c']");
List<Object> result = (List<Object>) new PyPathEvaluator("").evaluate(expression);
assertEquals(2, result.size());
assertEquals("ab", result.get(0));
assertEquals("c", result.get(1));
}
use of com.jetbrains.python.psi.impl.PyPathEvaluator in project intellij-community by JetBrains.
the class PyPathEvaluatorTest method testConstants.
public void testConstants() {
myFixture.configureByText(PythonFileType.INSTANCE, "ROOT_PATH = '/foo'\nTEMPLATES_DIR = os.path.join(ROOT_PATH, 'templates')");
PyFile file = (PyFile) myFixture.getFile();
final PyTargetExpression expression = file.findTopLevelAttribute("TEMPLATES_DIR");
final PyExpression value = expression.findAssignedValue();
final String result = FileUtil.toSystemIndependentName((String) new PyPathEvaluator("").evaluate(value));
assertEquals(result, "/foo/templates");
}
Aggregations