6 from pybind11_tests
import eval_
as m
11 assert m.test_eval_statements()
12 assert capture ==
"Hello World!" 15 assert m.test_eval_single_statement()
17 assert m.test_eval_failure()
20 @pytest.mark.xfail(
"env.PYPY", raises=RuntimeError)
22 filename = os.path.join(os.path.dirname(__file__),
"test_eval_call.py")
23 assert m.test_eval_file(filename)
25 assert m.test_eval_file_failure()
29 assert "__builtins__" in m.eval_empty_globals(
None)
32 assert "__builtins__" in m.eval_empty_globals(g)
33 assert "__builtins__" in g
37 global_, local = m.test_eval_closure()
39 assert global_[
"closure_value"] == 42
40 assert local[
"closure_value"] == 0
42 assert "local_value" not in global_
43 assert local[
"local_value"] == 0
45 assert "func_global" not in global_
46 assert local[
"func_global"]() == 42
48 assert "func_local" not in global_
49 with pytest.raises(NameError):
def test_eval_empty_globals()