File: //lib/python3/dist-packages/twisted/test/__pycache__/test_log.cpython-310.pyc
o
�b� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlmZm Z ddl
mZmZm
ZmZ ddlmZ ddlmZmZ ddlmZ ddlmZ G d d
� d
e�ZG dd� dej�ZG d
d� dej�ZG dd� de�Ze� e� G dd� d�Z!G dd� d�Z"G dd� de!e"�Z#G dd� d�Z$G dd� de$ej�Z%G dd� de$ej�Z&G dd� dej�Z'G dd � d ej�Z(G d!d"� d"ej�Z)G d#d$� d$ej�Z*dS )%z"
Tests for L{twisted.python.log}.
� N)�IOBase�StringIO)�LogBeginner�LoggingFile�LogLevel�LogPublisher)�handlerAndBytesIO)�failure�log)r )�unittestc @ s e Zd ZdZdS )�FakeWarningz
A unique L{Warning} subclass used by tests for interactions of
L{twisted.python.log} with the L{warnings} module.
N)�__name__�
__module__�__qualname__�__doc__� r r �7/usr/lib/python3/dist-packages/twisted/test/test_log.pyr s r c @ �@ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dS )�TextFromEventDictTestsz)
Tests for L{textFromEventDict}.
c C s$ t dd�}t�|�}| �|d� dS )zj
The C{"message"} value, when specified, is concatenated to generate the
message.
)�a�b�c)�messageza b cN��dictr
�textFromEventDict�assertEqual��self� eventDict�textr r r �test_message) s
z#TextFromEventDictTests.test_messagec C s* t ddddd�}t�|�}| �|d� dS )zW
The C{"format"} value, when specified, is used to format the message.
r r zHello, %(foo)s!�dude)r �isError�format�foozHello, dude!Nr r r r r �test_format2 s
z"TextFromEventDictTests.test_formatc C s$ t ddd�}t�|�}| �|� dS )zb
If C{"format"} is unspecified and C{"message"} is empty, return
L{None}.
r r �r r# N)r r
r �assertIsNoner r r r �test_noMessageNoFormat: s
z-TextFromEventDictTests.test_noMessageNoFormatc C sJ zt � � ty$ tddt�� dd�}t�|�}| �|�d�� Y dS w )zO
The C{"why"} value, when specified, is first part of message.
r � r% )r r# r �whyzfoo
N� �RuntimeError�
BaseExceptionr r �Failurer
r �
assertTrue�
startswithr r r r �test_whySpecifiedC s �
�z(TextFromEventDictTests.test_whySpecifiedc C sH zt � � ty# tddt�� d�}t�|�}| �|�d�� Y dS w )zY
The C{"why"} value, when unspecified, defaults to C{"Unhandled Error"}.
r r* �r r# r zUnhandled Error
Nr, r r r r �test_whyDefaultP s
�z&TextFromEventDictTests.test_whyDefaultc C s* t ddt� d�}t�|�}| �d|� dS )zk
If unable to obtain a traceback due to an exception, catch it and note
the error.
r r* r3 z
(unable to obtain traceback)N)r �objectr
r �assertInr r r r �test_noTracebackForYou[ s
z-TextFromEventDictTests.test_noTracebackForYouN)
r
r r r r! r&