mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
make z.getInterpreterContext().out().clear() work in PythonInterpreter
This commit is contained in:
parent
21dc20d886
commit
224a2df8e6
3 changed files with 8 additions and 1 deletions
|
|
@ -388,6 +388,7 @@ public class PythonInterpreter extends Interpreter implements ExecuteResultHandl
|
|||
|
||||
zeppelinContext.setGui(context.getGui());
|
||||
zeppelinContext.setNoteGui(context.getNoteGui());
|
||||
zeppelinContext.setInterpreterContext(context);
|
||||
|
||||
if (!pythonscriptRunning) {
|
||||
return new InterpreterResult(Code.ERROR, "python process not running"
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class PyZeppelinContext(object):
|
|||
self._setup_matplotlib()
|
||||
|
||||
def getInterpreterContext(self):
|
||||
return self.z.getCurrentInterpreterContext()
|
||||
return self.z.getInterpreterContext()
|
||||
|
||||
def input(self, name, defaultValue=""):
|
||||
return self.z.input(name, defaultValue)
|
||||
|
|
|
|||
|
|
@ -123,6 +123,12 @@ public class PythonInterpreterTest implements InterpreterOutputListener {
|
|||
assertEquals(InterpreterResult.Code.SUCCESS, pythonInterpreter.interpret(pyValidCode, context).code());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOutputClear() throws InterpreterException {
|
||||
InterpreterResult result = pythonInterpreter.interpret("print(\"Hello\")\nz.getInterpreterContext().out().clear()\nprint(\"world\")\n", context);
|
||||
assertEquals("%text world\n", out.getCurrentOutput().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateAll(InterpreterOutput out) {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue