403Webshell
Server IP : 185.11.201.71  /  Your IP : 192.168.7.18
Web Server : Apache/2.4.29 (Ubuntu)
System : Linux tech-virtual-machine 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
User : tech ( 1000)
PHP Version : 7.4.28
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/lib/python3.12/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/lib/python3.12/test/_test_embed_structseq.py
import sys
import types

# Note: This test file can't import `unittest` since the runtime can't
# currently guarantee that it will not leak memory. Doing so will mark
# the test as passing but with reference leaks. This can safely import
# the `unittest` library once there's a strict guarantee of no leaks
# during runtime shutdown.

# bpo-46417: Test that structseq types used by the sys module are still
# valid when Py_Finalize()/Py_Initialize() are called multiple times.
class TestStructSeq:
    # test PyTypeObject members
    def _check_structseq(self, obj_type):
        # ob_refcnt
        assert sys.getrefcount(obj_type) > 1
        # tp_base
        assert issubclass(obj_type, tuple)
        # tp_bases
        assert obj_type.__bases__ == (tuple,)
        # tp_dict
        assert isinstance(obj_type.__dict__, types.MappingProxyType)
        # tp_mro
        assert obj_type.__mro__ == (obj_type, tuple, object)
        # tp_name
        assert isinstance(type.__name__, str)
        # tp_subclasses
        assert obj_type.__subclasses__() == []

    def test_sys_attrs(self):
        for attr_name in (
            'flags',          # FlagsType
            'float_info',     # FloatInfoType
            'hash_info',      # Hash_InfoType
            'int_info',       # Int_InfoType
            'thread_info',    # ThreadInfoType
            'version_info',   # VersionInfoType
        ):
            attr = getattr(sys, attr_name)
            self._check_structseq(type(attr))

    def test_sys_funcs(self):
        func_names = ['get_asyncgen_hooks']  # AsyncGenHooksType
        if hasattr(sys, 'getwindowsversion'):
            func_names.append('getwindowsversion')  # WindowsVersionType
        for func_name in func_names:
            func = getattr(sys, func_name)
            obj = func()
            self._check_structseq(type(obj))


try:
    tests = TestStructSeq()
    tests.test_sys_attrs()
    tests.test_sys_funcs()
except SystemExit as exc:
    if exc.args[0] != 0:
        raise
print("Tests passed")

Youez - 2016 - github.com/yon3zu
LinuXploit