PythonInterpreter extends Interpreter { @Override public InterpreterResult interpret(String cmd, InterpreterContext contextInterpreter) { this.context = contextInterpreter; String output = sendCommandToPython(cmd); return new InterpreterResult(Code.SUCCESS, output.replaceAll(">>>", "") .replaceAll("\\.\\.\\.", "").trim()); } PythonInterpreter(Properties property); @Override void open(); @Override void close(); @Override InterpreterResult interpret(String cmd, InterpreterContext contextInterpreter); @Override void cancel(InterpreterContext context); @Override FormType getFormType(); @Override int getProgress(InterpreterContext context); @Override Scheduler getScheduler(); @Override List<InterpreterCompletion> completion(String buf, int cursor); PythonProcess getPythonProcess(); GUI getGui(); Integer getPy4JPort(); Boolean isPy4jInstalled(); static final String BOOTSTRAP_PY; static final String BOOTSTRAP_INPUT_PY; static final String ZEPPELIN_PYTHON; static final String DEFAULT_ZEPPELIN_PYTHON; }
@Test public void testInterpret() { pythonInterpreter.open(); cmdHistory = ""; InterpreterResult result = pythonInterpreter.interpret("print a", null); assertEquals(InterpreterResult.Code.SUCCESS, result.code()); assertEquals("%text print a", result.toString()); }