1 from __future__
import annotations
8 from pybind11_tests
import eval_
as m
13 assert m.test_eval_statements()
14 assert capture ==
"Hello World!"
17 assert m.test_eval_single_statement()
19 assert m.test_eval_failure()
22 @pytest.mark.xfail(
"env.PYPY", raises=RuntimeError)
24 filename = os.path.join(os.path.dirname(__file__),
"test_eval_call.py")
25 assert m.test_eval_file(filename)
27 assert m.test_eval_file_failure()
31 assert "__builtins__" in m.eval_empty_globals(
None)
34 assert "__builtins__" in m.eval_empty_globals(g)
35 assert "__builtins__" in g
39 global_, local = m.test_eval_closure()
41 assert global_[
"closure_value"] == 42
42 assert local[
"closure_value"] == 0
44 assert "local_value" not in global_
45 assert local[
"local_value"] == 0
47 assert "func_global" not in global_
48 assert local[
"func_global"]() == 42
50 assert "func_local" not in global_
51 with pytest.raises(NameError):