diff --git a/src/jlwrap/module.jl b/src/jlwrap/module.jl index 8d9832fa..b0b0a403 100644 --- a/src/jlwrap/module.jl +++ b/src/jlwrap/module.jl @@ -10,7 +10,7 @@ function pyjlmodule_dir(self::Module) end function pyjlmodule_seval(self::Module, expr::Py) - Py(Base.eval(self, Meta.parse(pyconvert(String, expr)))) + Py(Base.eval(self, Meta.parse(strip(pyconvert(String, expr))))) end function init_jlwrap_module() diff --git a/test/jlwrap.jl b/test/jlwrap.jl index 44f7d7ca..1310054b 100644 --- a/test/jlwrap.jl +++ b/test/jlwrap.jl @@ -149,11 +149,11 @@ end end @testitem "base" begin - + end @testitem "callback" begin - + end @testitem "dict" begin @@ -193,6 +193,11 @@ end @testset "bool" begin @test pytruth(pyjl(PythonCall)) end + @testset "seval" begin + m = Py(Main) + @test pyconvert(Any, m.seval("1 + 1")) === 2 # Basic behavior + @test pyconvert(Any, m.seval("1 + 1\n ")) === 2 # Trailing whitespace + end end @testitem "number" begin @@ -218,11 +223,11 @@ end end @testitem "objectarray" begin - + end @testitem "raw" begin - + end @testitem "set" begin