Your IP : 18.188.245.152
o
6��f�
� @ sR d dl Z d dlZddlmZ e�dddg�ZG dd� de j�ZG d d
� d
e�ZdS )� N� )�_BaseTestCaseContext�_LoggingWatcher�records�outputc @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �_CapturingHandlerzM
A logging handler capturing all (raw and formatted) logging output.
c C s t j�| � tg g �| _d S �N)�logging�Handler�__init__r �watcher��self� r �4/opt/alt/python310/lib64/python3.10/unittest/_log.pyr s z_CapturingHandler.__init__c C s d S r r r
r r r �flush s z_CapturingHandler.flushc C s* | j j�|� | �|�}| j j�|� d S r )r r �append�formatr )r �record�msgr r r �emit s
z_CapturingHandler.emitN)�__name__�
__module__�__qualname__�__doc__r r r r r r r r
s
r c @ s, e Zd ZdZdZdd� Zdd� Zdd� Zd S )
�_AssertLogsContextz6A context manager for assertLogs() and assertNoLogs() z"%(levelname)s:%(name)s:%(message)sc C s@ t �| |� || _|rtj�||�| _ntj| _d | _|| _ d S r )
r r �logger_namer Z_nameToLevel�get�level�INFOr �no_logs)r Z test_caser r r r r r r ! s
z_AssertLogsContext.__init__c C s� t | jtj�r| j }| _n t�| j� }| _t�| j�}t� }|� | j
� |�|� |j| _|j
d d � | _|j
| _|j| _|g|_
|� | j
� d|_| jrQd S |jS )NF)�
isinstancer r ZLogger�loggerZ getLoggerZ Formatter�LOGGING_FORMATr �setLevelr ZsetFormatterr �handlers�old_handlers� old_level� propagate�
old_propagater )r r"