mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
make z.getInterpreterContext().out().clear() work in IPythonInterprete
This commit is contained in:
parent
224a2df8e6
commit
e0dcda61fa
2 changed files with 8 additions and 0 deletions
|
|
@ -33,6 +33,9 @@ class PyZeppelinContext(object):
|
|||
self.javaList = gateway.jvm.java.util.ArrayList
|
||||
self.max_result = z.getMaxResult()
|
||||
|
||||
def getInterpreterContext(self):
|
||||
return self.z.getInterpreterContext()
|
||||
|
||||
def input(self, name, defaultValue=""):
|
||||
return self.z.input(name, defaultValue)
|
||||
|
||||
|
|
|
|||
|
|
@ -456,6 +456,11 @@ public class IPythonInterpreterTest {
|
|||
interpreterResultMessages = context.out.getInterpreterResultMessages();
|
||||
assertEquals(InterpreterResult.Type.TABLE, interpreterResultMessages.get(0).getType());
|
||||
assertEquals("id\tname\n1\ta\n2\tb\n3\tc\n", interpreterResultMessages.get(0).getData());
|
||||
|
||||
// clear output
|
||||
context = getInterpreterContext();
|
||||
result = interpreter.interpret("import time\nprint(\"Hello\")\ntime.sleep(0.5)\nz.getInterpreterContext().out().clear()\nprint(\"world\")\n", context);
|
||||
assertEquals("%text world\n", context.out.getCurrentOutput().toString());
|
||||
}
|
||||
|
||||
private static InterpreterContext getInterpreterContext() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue