
    Mh                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
mZ  ej        dej        ej                           Z ej        ej        dk    p
ej        dk    d          Z ej        dej        v d	          Z ej         ej                    d
k    p ej        d          d          Zd Z ej         e             d          Zd Zd Ze j        d             ZdZdedefdZdS )    N)bind_unused_port_TestCaseType)boundposixcygwinznon-unix platform
NO_NETWORKznetwork access disabledCPythonPy_GIL_DISABLEDzNot CPython implementationc                  J   t           j        sdS d } 	 t          j         t           j                  } |                     d           n)# t          $ r Y | |                                  dS dS w xY w	 | |                                  n# | |                                  w w xY wdS )NF)z::1r   T)sockethas_ipv6AF_INET6bindOSErrorclose)socks    Q/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/tornado/test/util.py_detect_ipv6r   !   s    ?  uD}V_--		*   JJLLLLL  	 JJLLL JJLLLL 4s)   3A B 
A,B +A,,B B zipv6 support not presentc                  >   t                      \  } }|                     d           t          j                    }|                    d|f           |                                 \  }}|                                 |                                  |j        |d         fS )zReturns a local port number that will refuse all connections.

    Return value is (cleanup_func, port); the cleanup function
    must be called to free the port to be reused.
    Tz	127.0.0.1   )r   setblockingr   connectacceptr   )server_socketportclient_socketconnclient_addrs        r   refusing_portr   5   s     +,,M4d###MOOM;-...%,,..D+JJLLLQ00    c                 j    t          | fi |}i }t          t          j        |          ||           |S )zExecute ``s`` in a given context and return the result namespace.

    Used to define functions for tests in particular python
    versions that would be syntax errors in older versions.
    )dictexectextwrapdedent)caller_globalscaller_localssglobal_namespacelocal_namespaces        r   	exec_testr+   I   sB     N<<m<<O		-???r    c               #      K   t          j                    5  t          j        dt                     dV  ddd           dS # 1 swxY w Y   dS )z/Context manager to ignore deprecation warnings.ignoreN)warningscatch_warningssimplefilterDeprecationWarning r    r   ignore_deprecationr3   X   s       
	 	"	"  h(:;;;                 s   AA	Azabstract base classclsreturnc                 (     G fdd|           S )a  Decorator to mark a test class as an "abstract" base class.

    This is different from a regular abstract base class because
    we do not limit instantiation of the class. (If we did, it would
    interfere with test discovery). Instead, we prevent the tests from
    being run.

    Subclasses of an abstract base test are run as normal. There is
    no support for the ``@abstractmethod`` decorator so there is no runtime
    check that all such methods are implemented.

    Note that while it is semantically cleaner to modify the test loader
    to exclude abstract base tests, this is more complicated and would
    interfere with third-party test runners. This approach degrades
    gracefully to other tools such as editor-integrated testing.
    c                   2     e Zd Ze fd            Z xZS )/abstract_base_test.<locals>.AbstractBaseWrapperc                     | u rt          j        t                    t          |                                            d S )N)unittestSkipTestABT_SKIP_MESSAGEsuper
setUpClass)r4   AbstractBaseWrapper	__class__s    r   r>   z:abstract_base_test.<locals>.AbstractBaseWrapper.setUpClassx   sD    )))'(8999%s++6688888r    )__name__
__module____qualname__classmethodr>   __classcell__)r@   r?   s   @r   r?   r8   w   sH        		9 	9 	9 	9 	9 
	9 	9 	9 	9 	9r    r?   r2   )r4   r?   s    @r   abstract_base_testrF   c   s?    (9 9 9 9 9 9 9c 9 9 9 r    ) 
contextlibosplatformr   sys	sysconfigr$   typingr:   r.   tornado.testingr   TypeVarTypeTestCaser   skipIfnameskipIfNonUnixenvironskipIfNoNetworkpython_implementationget_config_varskipNotCPythonr   skipIfNoIPv6r   r+   contextmanagerr3   r<   rF   r2   r    r   <module>r[      s       				   



         , , , , , ,fk(BS6TUUUGw2#,(24G  "(/,"*"<>WXX  #H"$$	1 3y 122    " x<<>>13MNN1 1 1(      ) M m      r    