Skip to content

Commit 6292147

Browse files
committed
JythonTest: decode variables before checking them
I could have sworn that I tested this, but apparently not. It turns out that return values are not decoded by default. So for the time being, let's just do it in the test here. (Ultimately, we probably want to decode them automatically.) Values extracted directly from the bindings are also not decoded, so let's decode those manually as well. (That should probably also be automatic, though I'm not sure.)
1 parent a2a5716 commit 6292147

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public void testBasic() throws InterruptedException, ExecutionException,
6464
final ScriptService scriptService = context.getService(ScriptService.class);
6565
final String script = "1 + 2";
6666
final ScriptModule m = scriptService.run("add.py", script, true).get();
67-
final Object result = m.getReturnValue();
67+
final Object result = m.getLanguage().decode(m.getReturnValue());
6868
assertSame(Integer.class, result.getClass());
6969
assertEquals(3, result);
7070
}
@@ -78,8 +78,8 @@ public void testLocals() throws ScriptException {
7878
final ScriptEngine engine = language.getScriptEngine();
7979
assertEquals(JythonScriptEngine.class, engine.getClass());
8080
engine.put("hello", 17);
81-
assertEquals("17", engine.eval("hello").toString());
82-
assertEquals("17", engine.get("hello").toString());
81+
assertEquals(17, language.decode(engine.eval("hello")));
82+
assertEquals(17, language.decode(engine.get("hello")));
8383

8484
final Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
8585
bindings.clear();

0 commit comments

Comments
 (0)