| Server IP : 138.197.107.151 / Your IP : 216.73.216.170 Web Server : Apache/2.4.58 (Ubuntu) System : Linux BloxBy-Builder 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : wpbetasites_mrakzqskir ( 1022) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/twisted/logger/test/__pycache__/ |
Upload File : |
�
oj�% � � � d Z ddlZddlmZ ddlmZmZmZ ddlm Z ddlmZ ddl
mZmZmZmZ dd lmZ dd
lmZ G d� dej, � Zy# e
$ r dZ Y �=w xY w)
z+
Test cases for L{twisted.logger._format}.
� N)�count)�Any�Callable�Optional)�tzset)�unittest� )�KeyFlattener�
aFormatter�extractField�flattenEvent)�formatEvent)�LogEventc � � e Zd ZdZdd�Zdd�Zdd�Zdd�Z ddee de fd �Z
dd
�Zdd�Zdd�Z
d
� fdee ge f ddfd�Zdd�Zdd�Zdd�Zdd�Zy)�FlatFormattingTestsz9
Tests for flattened event formatting functions.
�returnNc � �� t � � G d� d� }t d�fd� |� ddd�� }t |� t |� }|d = |d
= t j t j
|� � }| j
t |� d� y)
a)
L{flattenEvent} will "flatten" an event so that, if scrubbed of all but
serializable objects, it will preserve all necessary data to be
formatted once serialized. When presented with an event thusly
flattened, L{formatEvent} will produce the same output.
c � � e Zd ZdZy)�;FlatFormattingTests.test_formatFlatEvent.<locals>.Ephemeral�valueN)�__name__�
__module__�__qualname__� attribute� � �B/usr/lib/python3/dist-packages/twisted/logger/test/test_flatten.py� Ephemeralr % s � ��Ir r z�callable: {callme()} attribute: {object.attribute} numrepr: {number!r} numstr: {number!s} strrepr: {string!r} unistr: {unistr!s}c � �� t � � S �N)�next��counters �r �<lambda>z:FlatFormattingTests.test_formatFlatEvent.<locals>.<lambda>1 s �� �4��=� r � �hello� ö)�
log_format�callme�object�number�string�unistrr) r* uM callable: 0 attribute: value numrepr: 7 numstr: 7 strrepr: 'hello' unistr: öN)r �dictr
�json�loads�dumps�assertEqualr )�selfr �event1�event2�event3r# s @r �test_formatFlatEventz(FlatFormattingTests.test_formatFlatEvent s� �� � �'�� � � �%� )��;����
�� �V���f����8���8�����D�J�J�v�.�/���������
r c �� � t dd�� }t |� t j t j |� � }| j t
|� j d� � y)zH
If the format string is invalid, an error is produced.
zstrrepr: {string!X}r&