HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/asynctest/__pycache__/_fail_on.cpython-37.pyc
B

�P�e��@sTdZddlmZdZddd�ZGdd�d�Zdd	�Zd
d�Zdd
d�Zddd�Z	dS)a�
:class:`asynctest.TestCase` decorator which controls checks performed after
tests.

This module is separated from :mod:`asynctest.case` to avoid circular imports
in modules registering new checks.

To implement new checks:

    * its name must be added in the ``DEFAULTS`` dict,

    * a static method of the same name must be added to the :class:`_fail_on`
      class,

    * an optional static method named ``before_[name of the check]`` can be
      added to :class:`_fail_on` to implement some set-up before the test runs.

A check may be only available on some platforms, activated by a conditional
import. In this case, ``DEFAULT`` and :class:`_fail_on` can be updated in the
module. There is an example in the :mod:`asynctest.selector` module.
�)�TimerHandleZ_asynctest_fail_onF)�unused_loop�active_handlesc@sxeZdZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Zdd�Z	e
dd��Ze
dd��Ze
dd��Ze
dd��ZdS)�_fail_onNcCs|pi|_d|_dS)N)�checks�_computed_checks)�selfr�r	�C/opt/alt/python37/lib/python3.7/site-packages/asynctest/_fail_on.py�__init__'s
z_fail_on.__init__cCs>t|td�}|r&|��}|�|j�n|��}t|t|�|S)N)�getattr�
_FAIL_ON_ATTR�copy�updater�setattr)r�func�checkerr	r	r
�__call__+sz_fail_on.__call__TcCs:|r|j�|�n$x"|��D]\}}|j�||�qWdS)N)rr�items�
setdefault)rr�override�check�valuer	r	r
r6sz_fail_on.updatecCst|j���S)N)rrr)rr	r	r
r=sz
_fail_on.copycCsX|jdkrRt��}y|�t|td�j�Wntk
r>YnX|�|j�||_|jS)N)r�DEFAULTSrrrr
r�AttributeError)r�caserr	r	r
�
get_checks@s
z_fail_on.get_checksc
CsT|�|�}xDt|j|�D]4}yt|d|�|�Wqttfk
rJYqXqWdS)NZbefore_test_)r�filter�getrr�	TypeError)rrrrr	r	r
�before_testOs
z_fail_on.before_testcCs2|�|�}x"t|j|�D]}t||�|�qWdS)N)rrrr)rrrrr	r	r
�
check_testWs
z_fail_on.check_testcCs|jjs|�d�dS)Nz Loop did not run during the test)�loopZ_asynctest_ran�fail)rr	r	r
r^sz_fail_on.unused_loopcCst|t�o|jS)N)�
isinstancer�
_cancelled)�handler	r	r
�_is_live_timer_handlecsz_fail_on._is_live_timer_handlecCst|j|j�S)N)rr'�
_scheduled)�clsr"r	r	r
�_live_timer_handlesgsz_fail_on._live_timer_handlescCs(t|�|j��}|r$|�d�|��dS)Nz#Loop contained unfinished work {!r})�tupler*r"r#�format)r)rZhandlesr	r	r
rksz_fail_on.active_handles)N)T)�__name__�
__module__�__qualname__rrrrrr r!�staticmethodrr'�classmethodr*rr	r	r	r
r&s

rcKs,x"|D]}|tkrtd�|���qWt|�S)zk
    Enable checks on the loop state after a test ran to help testers to
    identify common mistakes.
    z1fail_on() got an unexpected keyword argument '{}')rrr,r)�kwargs�kwargr	r	r
�fail_onrs

r4cs.tt�fdd�tD���}|dkr&|S||�S)Nc3s|]}|�fVqdS)Nr	)�.0�arg)�flagr	r
�	<genexpr>�sz_fail_on_all.<locals>.<genexpr>)r�dictr)r7rrr	)r7r
�_fail_on_all�sr:NcCs
td|�S)zM
    Activate strict checking of the state of the loop after a test ran.
    T)r:)rr	r	r
�strict�sr;cCs
td|�S)z1
    Deactivate all checks after a test ran.
    F)r:)rr	r	r
�lenient�sr<)N)N)
�__doc__�asynciorr
rrr4r:r;r<r	r	r	r
�<module>sL