7from pybind11_tests
import eval_
as m
12 assert m.test_eval_statements()
13 assert capture ==
"Hello World!"
16 assert m.test_eval_single_statement()
18 assert m.test_eval_failure()
21@pytest.mark.xfail("env.PYPY and not env.PY2", raises=RuntimeError)
23 filename = os.path.join(os.path.dirname(__file__),
"test_eval_call.py")
24 assert m.test_eval_file(filename)
26 assert m.test_eval_file_failure()
30 assert "__builtins__" in m.eval_empty_globals(
None)
33 assert "__builtins__" in m.eval_empty_globals(g)
34 assert "__builtins__" in g
38 global_, local = m.test_eval_closure()
40 assert global_[
"closure_value"] == 42
41 assert local[
"closure_value"] == 0
43 assert "local_value" not in global_
44 assert local[
"local_value"] == 0
46 assert "func_global" not in global_
47 assert local[
"func_global"]() == 42
49 assert "func_local" not in global_
50 with pytest.raises(NameError):
def test_eval_empty_globals()