@@ -743,12 +743,21 @@ end
743743 @test pyeq (Bool, l[" x" ], 4 )
744744 # check global code runs in global scope
745745 pyexec (" global y; y=x+1" , g, l)
746- @test_throws PythonCall. PyException PythonCall. @pyexec (err = PythonCall. Core. pybuiltins. ValueError) => ` raise err`
747746 @test pyeq (Bool, g[" y" ], 5 )
748747 @test ! pycontains (l, " y" )
749748 # check pyeval converts types correctly
750749 @test pyeval (Int, " 1+1" , g) === 2
751750 @test pyeval (Nothing, " None" , g) === nothing
751+ # @pyexec
752+ @test_throws PyException @pyexec (` raise ValueError` )
753+ @test @pyexec (` 1 + 2` ) === nothing
754+ @test @pyexec (` ans = 1 + 2` => (ans:: Int ,)) === (ans= 3 ,)
755+ @test @pyexec ((x= 1 , y= 2 ) => ` ans = x + y` => (ans:: Int ,)) === (ans= 3 ,)
756+ # @pyeval
757+ @test_throws PyException @pyeval (` import sys` ) # not an expression
758+ @test_throws PyException @pyeval (` None + None` )
759+ @test @pyeval (` 1 + 2` => Int) === 3
760+ @test @pyeval ((x= 1 , y= 2 ) => ` x + y` => Int) === 3
752761end
753762
754763@testitem " @pyconst" begin
0 commit comments