cppyabm  1.0.17
An agent-based library to integrate C++ and Python
test_eval.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 import os
3 
4 import pytest
5 
6 import env # noqa: F401
7 
8 from pybind11_tests import eval_ as m
9 
10 
11 def test_evals(capture):
12  with capture:
13  assert m.test_eval_statements()
14  assert capture == "Hello World!"
15 
16  assert m.test_eval()
17  assert m.test_eval_single_statement()
18 
19  assert m.test_eval_failure()
20 
21 
22 @pytest.mark.xfail("env.PYPY and not env.PY2", raises=RuntimeError)
24  filename = os.path.join(os.path.dirname(__file__), "test_eval_call.py")
25  assert m.test_eval_file(filename)
26 
27  assert m.test_eval_file_failure()
28 
29 
31  assert "__builtins__" in m.eval_empty_globals(None)
32 
33  g = {}
34  assert "__builtins__" in m.eval_empty_globals(g)
35  assert "__builtins__" in g
test_eval.test_eval_file
def test_eval_file()
Definition: test_eval.py:23
test_eval.test_eval_empty_globals
def test_eval_empty_globals()
Definition: test_eval.py:30
test_eval.test_evals
def test_evals(capture)
Definition: test_eval.py:11