コード例 #1
0
ファイル: test_interpreter.py プロジェクト: Debug-Orz/Sypy
    def test_call(self):
        code = compile("""
def g():
    return 4
def f():
    return g() + 3
res = f()""", "<string>", "exec")
        globs = {}
        mod_res = execution.run_from_cpython_code(code, [], globs, globs)
        assert mod_res is objects.spli_None
        assert len(globs) == 3
        assert globs["res"].as_int() == 7
コード例 #2
0
ファイル: test_interpreter.py プロジェクト: xx312022850/pypy
    def test_call(self):
        code = compile(
            """
def g():
    return 4
def f():
    return g() + 3
res = f()""", "<string>", "exec")
        globs = {}
        mod_res = execution.run_from_cpython_code(code, [], globs, globs)
        assert mod_res is objects.spli_None
        assert len(globs) == 3
        assert globs["res"].as_int() == 7
コード例 #3
0
ファイル: test_interpreter.py プロジェクト: xx312022850/pypy
 def eval(self, func, args=[]):
     return execution.run_from_cpython_code(func.func_code, args)
コード例 #4
0
ファイル: test_interpreter.py プロジェクト: Debug-Orz/Sypy
 def eval(self, func, args=[]):
     return execution.run_from_cpython_code(func.func_code, args)