§
    Ètºf{Y  ã                   ó´  — d Z ddlmZmZmZmZ 	 ddlmZ e n# e$ r dZY nw xY wddl	m
Z
 ddlmZmZmZ ddlmZ ddlmZ d	d
lmZmZmZmZmZmZ d	dlmZ d	dlmZ  G d„ dej        ¦  «        Z G d„ dej        ¦  «        Z  G d„ dej        ¦  «        Z! G d„ dej        ¦  «        Z" G d„ d¦  «        Z# G d„ de$¦  «        Z% G d„ dej        ¦  «        Z&dS )z+
Test cases for L{twisted.logger._format}.
é    )ÚAnyStrÚDictÚOptionalÚcast)ÚtzsetN)ÚFailure)ÚaddTZCleanupÚmktimeÚsetTZ)Úunittest)ÚSkipTesté   )ÚeventAsTextÚformatEventÚformatEventAsClassicLogTextÚ
formatTimeÚformatUnformattableEventÚformatWithCall)ÚLogEvent)ÚLogLevelc                   ón   — e Zd ZdZdededefd„Zdd„Zdd„Z	dd	„Z
dd
„Zdd„Zdd„Zdd„Zdd„Zdd„ZdS )ÚFormattingTestsz5
    Tests for basic event formatting functions.
    Ú	logFormatÚeventÚreturnc                 ó~   — ||d<   t          |¦  «        }|                      t          |¦  «        t          ¦  «         |S )zÖ
        Create a Twisted log event dictionary from C{event} with the given
        C{logFormat} format string, format it with L{formatEvent}, ensure that
        its type is L{str}, and return its result.
        Ú
log_format)r   ÚassertIsÚtypeÚstr)Úselfr   r   Úresults       ú^/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/twisted/logger/test/test_format.pyÚformatzFormattingTests.format'   s:   € ð (ˆˆlÑÝ˜UÑ#Ô#ˆØ�Š•d˜6‘l”l¥CÑ(Ô(Ð(Øˆó    Nc                 óò  — |                       d|                      d¦  «        ¦  «         |                       d|                      d¦  «        ¦  «         |                       d|                      dd¬¦  «        ¦  «         |                       d|                      ddd	„ ¬
¦  «        ¦  «         |                       d|                      d¦  «        ¦  «         |                      d|                      d¦  «        ¦  «         |                      dd¬¦  «        }|                      d|¦  «         t          t	          d¦  «        ¦  «        }|                      d|z   dz   |                      dd¬¦  «        ¦  «         dS )ac  
        L{formatEvent} will format an event according to several rules:

            - A string with no formatting instructions will be passed straight
              through.

            - PEP 3101 strings will be formatted using the keys and values of
              the event as named fields.

            - PEP 3101 keys ending with C{()} will be treated as instructions
              to call that key (which ought to be a callable) before
              formatting.

        L{formatEvent} will always return L{str}, and if given bytes, will
        always treat its format string as UTF-8 encoded.
        Ú r%   Úabcz{x})Úxzno, yes.z{not_called}, {called()}.Únoc                  ó   — dS )NÚyes© r-   r%   r#   ú<lambda>z2FormattingTests.test_formatEvent.<locals>.<lambda>I   s   € ÈU€ r%   )Ú
not_calledÚcalledu   SÃ¡nchezs   SÃ¡nchezúUnable to format events   Sánchezs   S{a!s}nchezó   á)ÚazSb'\xe1'nchezÚSÚnchezs   S{a!r}nchezN)ÚassertEqualr$   ÚassertInr    Úrepr)r!   ÚmaybeResultÚxe1s      r#   Útest_formatEventz FormattingTests.test_formatEvent2   s\  € ð" 	×Ò˜˜TŸ[š[¨Ñ-Ô-Ñ.Ô.Ð.Ø×Ò˜˜TŸ[š[¨™_œ_Ñ-Ô-Ð-Ø×Ò˜ §¢¨E°U Ñ ;Ô ;Ñ<Ô<Ð<Ø×ÒØØ�KŠKØ+¸À]À]ð ñ ô ñ	
ô 	
ð 	
ð 	×Ò˜ t§{¢{Ð3DÑ'EÔ'EÑFÔFÐFØ�ŠÐ.°·²¸MÑ0JÔ0JÑKÔKÐKØ—k’k .°G�kÑ<Ô<ˆØ�ŠÐ&¨Ñ4Ô4Ð4å•$�w‘-”-Ñ Ô ˆØ�Š�c˜C‘i 'Ñ)¨4¯;ª;°~È¨;Ñ+QÔ+QÑRÔRÐRÐRÐRr%   c                 ó†   —  G d„ d¦  «        }|                       d|                      d |¦   «         ¬¦  «        ¦  «         dS )zq
        L{formatEvent} will format PEP 3101 keys containing C{.}s ending with
        C{()} as methods.
        c                   ó   — e Zd Zdefd„ZdS )ú0FormattingTests.test_formatMethod.<locals>.Worldr   c                 ó   — dS )NÚworldr-   ©r!   s    r#   Úwherez6FormattingTests.test_formatMethod.<locals>.World.where[   s   € Ø�wr%   N)Ú__name__Ú
__module__Ú__qualname__r    rB   r-   r%   r#   ÚWorldr>   Z   s/   € € € € € ð˜sð ð ð ð ð ð r%   rF   zhello worldzhello {what.where()})ÚwhatN)r6   r$   )r!   rF   s     r#   Útest_formatMethodz!FormattingTests.test_formatMethodT   sj   € ð	ð 	ð 	ð 	ð 	ñ 	ô 	ð 	ð 	×ÒØ˜4Ÿ;š;Ð'=ÀEÀEÁGÄG˜;ÑLÔLñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ó’   —  G d„ dt           ¦  «        }|                      d|                      d |¦   «         ¬¦  «        ¦  «         dS )zS
        L{formatEvent} will format subscripts of attributes per PEP 3101.
        c                   óD   — e Zd ZU  edd¬¦  «        Zeeef         ed<   dS )ú>FormattingTests.test_formatAttributeSubscript.<locals>.ExampleÚbarÚqux)ÚfooÚbazÚconfigN)rC   rD   rE   ÚdictrP   r   r    Ú__annotations__r-   r%   r#   ÚExamplerK   g   s9   € € € € € € Ø%) T¨e¸Ð%?Ñ%?Ô%?ˆF�D˜˜c˜”NÐ?Ð?Ñ?Ð?Ð?r%   rS   zbar quxz+{example.config[foo]} {example.config[baz]})ÚexampleN)Úobjectr6   r$   )r!   rS   s     r#   Útest_formatAttributeSubscriptz-FormattingTests.test_formatAttributeSubscriptb   s}   € ð
	@ð 	@ð 	@ð 	@ð 	@•fñ 	@ô 	@ð 	@ð 	×ÒØØ�KŠKØ=Ø˜™	œ	ð ñ ô ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ór   — t          dd¬¦  «        }t          |¦  «        }|                      d|¦  «         dS )z5
        Formatting an event with no format.
        é   r   )rN   rL   r'   N)rQ   r   r6   ©r!   r   r"   s      r#   Útest_formatEventNoFormatz(FormattingTests.test_formatEventNoFormatr   s?   € õ ˜ Ð"Ñ"Ô"ˆÝ˜UÑ#Ô#ˆà×Ò˜˜VÑ$Ô$Ð$Ð$Ð$r%   c                 óÒ   — t          t          ¦   «         dd¬¦  «        }t          |¦  «        }|                      d|¦  «         |                      t	          |¦  «        |¦  «         dS )z:
        Formatting an event with a bogus format.
        rX   r   )r   rN   rL   zLog format must be strN)rQ   rU   r   r7   r8   rY   s      r#   Útest_formatEventWeirdFormatz+FormattingTests.test_formatEventWeirdFormat{   s^   € õ ¥¡¤¨a°QÐ7Ñ7Ô7ˆÝ˜UÑ#Ô#ˆà�ŠÐ.°Ñ7Ô7Ð7Ø�Š•d˜5‘k”k 6Ñ*Ô*Ð*Ð*Ð*r%   c                 óº   — t          dd„ ¬¦  «        }t          |¦  «        }|                      d|¦  «         |                      t          |¦  «        |¦  «         dS )zF
        Formatting an event that's just plain out to get us.
        ú{evil()}c                  ó   — ddz  S ©NrX   r   r-   r-   r%   r#   r.   z?FormattingTests.test_formatUnformattableEvent.<locals>.<lambda>‰   s
   € ¸¸Q¹€ r%   ©r   Úevilr1   N)rQ   r   r7   r8   rY   s      r#   Útest_formatUnformattableEventz-FormattingTests.test_formatUnformattableEvent…   sZ   € õ  
°°Ð?Ñ?Ô?ˆÝ˜UÑ#Ô#ˆà�ŠÐ.°Ñ7Ô7Ð7Ø�Š•d˜5‘k”k 6Ñ*Ô*Ð*Ð*Ð*r%   c           	      óø   — dddd„ t          t          t          ¦   «         ¦  «        di}t          |¦  «        }|                      d|¦  «         |                      d|¦  «         |                      d|¦  «         d	S )
zR
        Formatting an unformattable event that has an unformattable key.
        r   r^   rb   c                  ó   — ddz  S r`   r-   r-   r%   r#   r.   zSFormattingTests.test_formatUnformattableEventWithUnformattableKey.<locals>.<lambda>•   ó
   € ˜A ™E€ r%   Úgurkú*MESSAGE LOST: unformattable object logged:úRecoverable data:úException during formatting:N)r   r    ÚUnformattabler   r7   rY   s      r#   Ú1test_formatUnformattableEventWithUnformattableKeyzAFormattingTests.test_formatUnformattableEventWithUnformattableKey�   s~   € ð
 ˜*Ø�M�MÝ••m‘o”oÑ&Ô&¨ð
ˆõ
 ˜UÑ#Ô#ˆØ�ŠÐBÀFÑKÔKÐKØ�ŠÐ)¨6Ñ2Ô2Ð2Ø�ŠÐ4°fÑ=Ô=Ð=Ð=Ð=r%   c                 óæ   — t          dd„ t          ¦   «         ¬¦  «        }t          |¦  «        }|                      d|¦  «         |                      d|¦  «         |                      d|¦  «         dS )úT
        Formatting an unformattable event that has an unformattable value.
        r^   c                  ó   — ddz  S r`   r-   r-   r%   r#   r.   zUFormattingTests.test_formatUnformattableEventWithUnformattableValue.<locals>.<lambda>£   ó
   € ˜˜Q™€ r%   )r   rb   rg   rh   ri   rj   N)rQ   rk   r   r7   rY   s      r#   Ú3test_formatUnformattableEventWithUnformattableValuezCFormattingTests.test_formatUnformattableEventWithUnformattableValue�   s{   € õ Ø!Ø�Ý‘”ð
ñ 
ô 
ˆõ
 ˜UÑ#Ô#ˆØ�ŠÐBÀFÑKÔKÐKØ�ŠÐ)¨6Ñ2Ô2Ð2Ø�ŠÐ4°fÑ=Ô=Ð=Ð=Ð=r%   c                 ó"  — t          dd„ d¬¦  «        }t          |t          t          t	          ¦   «         ¦  «        ¦  «        }|                      d|¦  «         |                      t          d¦  «        dz   t          d¦  «        z   |¦  «         dS )	rn   r^   c                  ó   — ddz  S r`   r-   r-   r%   r#   r.   zbFormattingTests.test_formatUnformattableEventWithUnformattableErrorOMGWillItStop.<locals>.<lambda>±   rp   r%   Úokay)r   rb   Úrecoverablerh   ru   z = N)rQ   r   r   ÚBaseExceptionrk   r7   r8   rY   s      r#   Ú@test_formatUnformattableEventWithUnformattableErrorOMGWillItStopzPFormattingTests.test_formatUnformattableEventWithUnformattableErrorOMGWillItStop«   s‰   € õ Ø!Ø�Øð
ñ 
ô 
ˆõ *¨%µµmÅ]Á_Ä_Ñ1UÔ1UÑVÔVˆØ�ŠÐBÀFÑKÔKÐKØ�Š•d˜=Ñ)Ô)¨EÑ1µD¸±L´LÑ@À&ÑIÔIÐIÐIÐIr%   ©r   N)rC   rD   rE   Ú__doc__r   rU   r    r$   r;   rH   rV   rZ   r\   rc   rl   rq   rw   r-   r%   r#   r   r   "   s  € € € € € ðð ð	 ð 	°ð 	¸Cð 	ð 	ð 	ð 	ð Sð  Sð  Sð  SðD
ð 
ð 
ð 
ð
ð 
ð 
ð 
ð %ð %ð %ð %ð+ð +ð +ð +ð+ð +ð +ð +ð>ð >ð >ð >ð>ð >ð >ð >ðJð Jð Jð Jð Jð Jr%   r   c                   óB   — e Zd ZdZd
d„Zd
d„Zd
d„Zd
d„Zd
d„Zd
d	„Z	dS )ÚTimeFormattingTestsz.
    Tests for time formatting functions.
    r   Nc                 ó$   — t          | ¦  «         d S )N)r	   rA   s    r#   ÚsetUpzTimeFormattingTests.setUp¿   s   € Ý�TÑÔÐÐÐr%   c                 óì   ‡ — t           €t          d¦  «        ‚dt          dt          t                   dt          ddfˆ fd„} |ddd	¦  «          |d
dd¦  «          |ddd¦  «          |ddd¦  «         dS )z¤
        Default time stamp format is RFC 3339 and offset respects the timezone
        as set by the standard C{TZ} environment variable and L{tzset} API.
        Nú:Platform cannot change timezone; unable to verify offsets.ÚnameÚexpectedDSTÚexpectedSTDr   c                 óö   •— t          | ¦  «         t          d¦  «        }‰                     t          |¦  «        |¦  «         |r4t          d¦  «        }‰                     t          |¦  «        |¦  «         d S d S )N)	i×  rX   é   r   r   r   r   r„   r   )	iÖ  é   é   r   r   r   é   éµ   rX   )r   r
   r6   r   )r€   r�   r‚   ÚlocalSTDÚlocalDSTr!   s        €r#   ÚtestForTimeZonezMTimeFormattingTests.test_formatTimeWithDefaultFormat.<locals>.testForTimeZoneÊ   sƒ   ø€ õ �$‰KŒKˆKåÐ>Ñ?Ô?ˆHØ×Ò�Z¨Ñ1Ô1°;Ñ?Ô?Ð?àð DÝ!Ð"CÑDÔD�Ø× Ò ¥¨HÑ!5Ô!5°{ÑCÔCÐCÐCÐCðDð Dr%   úUTC+00z2007-01-31T00:00:00+0000zEST+05EDT,M4.1.0,M10.5.0z2006-06-30T00:00:00-0400z2007-01-31T00:00:00-0500zCEST-01CEDT,M4.1.0,M10.5.0z2006-06-30T00:00:00+0200z2007-01-31T00:00:00+0100zCST+06z2007-01-31T00:00:00-0600)r   r   r    r   )r!   r‹   s   ` r#   Ú test_formatTimeWithDefaultFormatz4TimeFormattingTests.test_formatTimeWithDefaultFormatÂ   së   ø€ õ
 ˆ=ÝÐWÑXÔXÐXð
	DÝð
	DÝ$,­S¤Mð
	DÝ@Cð
	Dàð
	Dð 
	Dð 
	Dð 
	Dð 
	Dð 
	Dð 	ˆØØØ&ñ	
ô 	
ð 	
ð 	ˆØ&Ø&Ø&ñ	
ô 	
ð 	
ð 	ˆØ(Ø&Ø&ñ	
ô 	
ð 	
ð 	ˆØØØ&ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ó–   — |                       t          d¦  «        d¦  «         |                       t          dd¬¦  «        d¦  «         dS )zL
        If C{when} argument is L{None}, we get the default output.
        Nú-ú!)Údefault©r6   r   rA   s    r#   Útest_formatTimeWithNoTimez-TimeFormattingTests.test_formatTimeWithNoTimeò   sK   € ð 	×Ò� DÑ)Ô)¨3Ñ/Ô/Ð/Ø×Ò� D°#Ð6Ñ6Ô6¸Ñ<Ô<Ð<Ð<Ð<r%   c                 óº   — t          d¦  «        }|                      t          |d¬¦  «        d¦  «         |                      t          |dd¬¦  «        d¦  «         dS )zR
        If C{timeFormat} argument is L{None}, we get the default output.
        ©	iÝ  é	   é   é   é(   é/   rX   i  éÿÿÿÿN©Ú
timeFormatr�   r�   )r�   r‘   ©r
   r6   r   ©r!   Úts     r#   Útest_formatTimeWithNoFormatz/TimeFormattingTests.test_formatTimeWithNoFormatù   s`   € õ Ð8Ñ9Ô9ˆØ×Ò� A°$Ð7Ñ7Ô7¸Ñ=Ô=Ð=Ø×Ò� A°$ÀÐDÑDÔDÀcÑJÔJÐJÐJÐJr%   c                 ón   — t          d¦  «        }|                      t          |d¬¦  «        d¦  «         dS )z2
        Alternate time format in output.
        r•   z%Y/%Wrœ   z2013/38Nrž   rŸ   s     r#   Ú&test_formatTimeWithAlternateTimeFormatz:TimeFormattingTests.test_formatTimeWithAlternateTimeFormat  s;   € õ Ð8Ñ9Ô9ˆØ×Ò� A°'Ð:Ñ:Ô:¸IÑFÔFÐFÐFÐFr%   c                 óP   — |                       t          dd¬¦  «        d¦  «         dS )z0
        "%f" supported in time format.
        g’?x€„.Az%frœ   Ú234560Nr’   rA   s    r#   Útest_formatTimePercentFz+TimeFormattingTests.test_formatTimePercentF  s-   € ð 	×Ò� M¸dÐCÑCÔCÀXÑNÔNÐNÐNÐNr%   rx   )
rC   rD   rE   ry   r}   r�   r“   r¡   r£   r¦   r-   r%   r#   r{   r{   º   s¥   € € € € € ðð ðð ð ð ð.
ð .
ð .
ð .
ð`=ð =ð =ð =ðKð Kð Kð KðGð Gð Gð GðOð Oð Oð Oð Oð Or%   r{   c                   ój   — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd	„Z	dd
„Z
dd„Zdd„Zdd„Zdd„ZdS )ÚClassicLogFormattingTestsz@
    Tests for classic text log event formatting functions.
    r   Nc                 óô   — t           €t          d¦  «        ‚t          | ¦  «         t          d¦  «         t	          d¦  «        }t          d|¬¦  «        }|                      t          |¦  «        d¦  «         dS )zÂ
        Time is first field.  Default time stamp format is RFC 3339 and offset
        respects the timezone as set by the standard C{TZ} environment variable
        and L{tzset} API.
        Nr   rŒ   r•   ÚXYZZY©r   Úlog_timez%2013-09-24T11:40:47+0000 [-#-] XYZZY
)r   r   r	   r   r
   rQ   r6   r   )r!   r    r   s      r#   Útest_formatTimeDefaultz0ClassicLogFormattingTests.test_formatTimeDefault  s�   € õ ˆ=ÝÐWÑXÔXÐXå�TÑÔÐÝˆh‰ŒˆåÐ8Ñ9Ô9ˆÝ °!Ð4Ñ4Ô4ˆØ×ÒÝ'¨Ñ.Ô.Ø7ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ó¬   — dt           t                   dt          fd„}t          dd¬¦  «        }|                      t          ||¬¦  «        d¦  «         d	S )
zc
        Time is first field.  Custom formatting function is an optional
        argument.
        r    r   c                 ó   — d| › d�S )NÚ__r-   )r    s    r#   r   zCClassicLogFormattingTests.test_formatTimeCustom.<locals>.formatTime-  s   € Ø˜�:�:�:Ðr%   rª   i90  r«   )r   z__12345__ [-#-] XYZZY
N)r   Úfloatr    rQ   r6   r   )r!   r   r   s      r#   Útest_formatTimeCustomz/ClassicLogFormattingTests.test_formatTimeCustom'  sq   € ð	�(¥5œ/ð 	­cð 	ð 	ð 	ð 	õ  °%Ð8Ñ8Ô8ˆØ×ÒÝ'¨¸*ÐEÑEÔEØ(ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ón   — t          dd¬¦  «        }|                      t          |¦  «        d¦  «         dS )z:
        Namespace is first part of second field.
        rª   úmy.namespace)r   Úlog_namespacez- [my.namespace#-] XYZZY
N©rQ   r6   r   ©r!   r   s     r#   Útest_formatNamespacez.ClassicLogFormattingTests.test_formatNamespace6  sF   € õ  °~ÐFÑFÔFˆØ×ÒÝ'¨Ñ.Ô.Ø+ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ó‚   — t          dt          j        ¬¦  «        }|                      t	          |¦  «        d¦  «         dS )z7
        Level is second part of second field.
        rª   )r   Ú	log_levelz- [-#warn] XYZZY
N©rQ   r   Úwarnr6   r   r·   s     r#   Útest_formatLevelz*ClassicLogFormattingTests.test_formatLevel@  sH   € õ  µ8´=ÐAÑAÔAˆØ×ÒÝ'¨Ñ.Ô.Ø#ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ón   — t          dd¬¦  «        }|                      t          |¦  «        d¦  «         dS )z)
        System is second field.
        rª   úS.Y.S.T.E.M.©r   Ú
log_systemú- [S.Y.S.T.E.M.] XYZZY
Nr¶   r·   s     r#   Útest_formatSystemz+ClassicLogFormattingTests.test_formatSystemJ  sF   € õ  °NÐCÑCÔCˆØ×ÒÝ'¨Ñ.Ô.Ø&ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ó†   — t          ddt          j        d¬¦  «        }|                      t	          |¦  «        d¦  «         dS )úB
        System is not supplanted by namespace and level.
        rª   r´   r¿   )r   rµ   rº   rÁ   rÂ   Nr»   r·   s     r#   Útest_formatSystemRulzz/ClassicLogFormattingTests.test_formatSystemRulzT  sX   € õ ØØ(Ý”mØ%ð	
ñ 
ô 
ˆð 	×ÒÝ'¨Ñ.Ô.Ø&ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ó†   — t          dt          ¦   «         ¬¦  «        }|                      t          |¦  «        d¦  «         dS )rÅ   rª   rÀ   z- [UNFORMATTABLE] XYZZY
N)rQ   rk   r6   r   r·   s     r#   Útest_formatSystemUnformattablez8ClassicLogFormattingTests.test_formatSystemUnformattablec  sJ   € õ  µM±O´OÐDÑDÔDˆØ×ÒÝ'¨Ñ.Ô.Ø'ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ón   — t          dd¬¦  «        }|                      t          |¦  «        d¦  «         dS )z0
        Formatted event is last field.
        zid:{id}Ú123©r   Úidz- [-#-] id:123
Nr¶   r·   s     r#   Útest_formatFormatz+ClassicLogFormattingTests.test_formatFormatm  sF   € õ  	¨eÐ4Ñ4Ô4ˆØ×ÒÝ'¨Ñ.Ô.Ø!ñ	
ô 	
ð 	
ð 	
ð 	
r%   c                 ól   — t          d¬¦  «        }|                      t          |¦  «        d¦  «         dS )z#
        No format string.
        rÊ   )rÌ   N©rQ   r   r   r·   s     r#   Útest_formatNoFormatz-ClassicLogFormattingTests.test_formatNoFormatw  s4   € õ ˜�‘”ˆØ�ŠÕ1°%Ñ8Ô8¸$Ñ?Ô?Ð?Ð?Ð?r%   c                 ón   — t          dd¬¦  «        }|                      t          |¦  «        d¦  «         dS )z&
        Empty format string.
        r'   rÊ   rË   NrÏ   r·   s     r#   Útest_formatEmptyFormatz0ClassicLogFormattingTests.test_formatEmptyFormat~  s9   € õ   uÐ-Ñ-Ô-ˆØ�ŠÕ1°%Ñ8Ô8¸$Ñ?Ô?Ð?Ð?Ð?r%   c                 ól   — t          d¬¦  «        }|                      t          |¦  «        d¦  «         dS )zO
        If the formatted event has newlines, indent additional lines.
        z"XYZZY
A hollow voice says:
"Plugh")r   z-- [-#-] XYZZY
	A hollow voice says:
	"Plugh"
Nr¶   r·   s     r#   Útest_formatFormatMultiLinez4ClassicLogFormattingTests.test_formatFormatMultiLine…  sE   € õ Ð FÐGÑGÔGˆØ×ÒÝ'¨Ñ.Ô.ØCñ	
ô 	
ð 	
ð 	
ð 	
r%   rx   )rC   rD   rE   ry   r­   r²   r¸   r½   rÃ   rÆ   rÈ   rÍ   rÐ   rÒ   rÔ   r-   r%   r#   r¨   r¨     s  € € € € € ðð ð
ð 
ð 
ð 
ð&
ð 
ð 
ð 
ð
ð 
ð 
ð 
ð
ð 
ð 
ð 
ð
ð 
ð 
ð 
ð
ð 
ð 
ð 
ð
ð 
ð 
ð 
ð
ð 
ð 
ð 
ð@ð @ð @ð @ð@ð @ð @ð @ð
ð 
ð 
ð 
ð 
ð 
r%   r¨   c                   ó   — e Zd ZdZdd„ZdS )ÚFormatFieldTestsz+
    Tests for format field functions.
    r   Nc           	      óÔ   — |                       t          dt          dd„ ¬¦  «        ¦  «        d¦  «         |                       t          dt          d„ ¬¦  «        ¦  «        d	¦  «         d
S )zú
        L{formatWithCall} is an extended version of L{str.format} that
        will interpret a set of parentheses "C{()}" at the end of a format key
        to mean that the format key ought to be I{called} rather than
        stringified.
        zHello, {world}. {callme()}.Úearthc                  ó   — dS )NÚmayber-   r-   r%   r#   r.   z6FormatFieldTests.test_formatWithCall.<locals>.<lambda>Ÿ  s   € °7€ r%   )r@   ÚcallmezHello, earth. maybe.zHello, {repr()!r}.c                  ó   — dS )Nr8   r-   r-   r%   r#   r.   z6FormatFieldTests.test_formatWithCall.<locals>.<lambda>¤  s   € À6€ r%   )r8   zHello, 'repr'.N)r6   r   rQ   rA   s    r#   Útest_formatWithCallz$FormatFieldTests.test_formatWithCall•  s…   € ð 	×ÒÝØ-Ý˜7¨?¨?Ð;Ñ;Ô;ñô ð #ñ	
ô 	
ð 	
ð 	×ÒÝÐ/µ¸>¸>Ð1JÑ1JÔ1JÑKÔKØñ	
ô 	
ð 	
ð 	
ð 	
r%   rx   )rC   rD   rE   ry   rÝ   r-   r%   r#   rÖ   rÖ   �  s2   € € € € € ðð ð
ð 
ð 
ð 
ð 
ð 
r%   rÖ   c                   ó   — e Zd ZdZdefd„ZdS )rk   z>
    An object that raises an exception from C{__repr__}.
    r   c                 ó&   — t          ddz  ¦  «        S r`   )r    rA   s    r#   Ú__repr__zUnformattable.__repr__®  s   € Ý�1�q‘5‰zŒzÐr%   N)rC   rD   rE   ry   r    rà   r-   r%   r#   rk   rk   ©  s9   € € € € € ðð ð˜#ð ð ð ð ð ð r%   rk   c                   ó   — e Zd ZdZdS )ÚCapturedErrorz3
    A captured error for use in format tests.
    N)rC   rD   rE   ry   r-   r%   r#   râ   râ   ²  s   € € € € € ðð ð ð r%   râ   c                   óz   — e Zd ZdZdd„Zdd„Zdd„Zdd„Zdd„Zdd	„Z	dd
„Z
dd„Zdd„Zdd„Zdd„Zdd„Zdd„ZdS )ÚEventAsTextTestszi
    Tests for L{eventAsText}, all of which ensure that the
    returned type is UTF-8 decoded text.
    r   Nc                 ó.  — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wddi}||d<   t          |dd¬¦  «        }|                      t	          |                     ¦   «         ¦  «        |¦  «         |                      d|¦  «         dS )	zT
        An event with a C{log_failure} key will have a traceback appended.
        úThis is a fake errorr   úThis is a test log messageÚlog_failureTF©ÚincludeTimestampÚincludeSystemN©râ   r   r   r7   r    ÚgetTraceback©r!   Úfr   Ú	eventTexts       r#   Útest_eventWithTracebackz(EventAsTextTests.test_eventWithTraceback¾  sª   € ð	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøð (Ð)EÐFˆØ ˆˆmÑÝ ¸ÈEÐRÑRÔRˆ	Ø�Š•c˜!Ÿ.š.Ñ*Ô*Ñ+Ô+¨YÑ7Ô7Ð7Ø�ŠÐ2°IÑ>Ô>Ð>Ð>Ð>ó   ‚ ‘,«,c                 ó.  — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wddi}||d<   t          |dd¬¦  «        }|                      t	          |                     ¦   «         ¦  «        |¦  «         |                      d|¦  «         dS )	zu
        An event with an empty C{log_format} key appends a traceback from
        the accompanying failure.
        ræ   r   r'   rè   TFré   Nrì   rî   s       r#   Ú"test_formatEmptyEventWithTracebackz3EventAsTextTests.test_formatEmptyEventWithTracebackÍ  s§   € ð
	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøà'¨Ð,ˆØ ˆˆmÑÝ ¸ÈEÐRÑRÔRˆ	Ø�Š•c˜!Ÿ.š.Ñ*Ô*Ñ+Ô+¨YÑ7Ô7Ð7Ø�ŠÐ,¨iÑ8Ô8Ð8Ð8Ð8rò   c                 óh  — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wdd„ dœ}||d<   t          |dd¬¦  «        }|                      |t          ¦  «         |                      t	          |                     ¦   «         ¦  «        |¦  «         |                      d|¦  «         d	S )
zw
        An event with an unformattable value in the C{log_format} key still
        has a traceback appended.
        ræ   r^   c                  ó   — ddz  S r`   r-   r-   r%   r#   r.   zHEventAsTextTests.test_formatUnformattableWithTraceback.<locals>.<lambda>è  rf   r%   ra   rè   TFré   N)râ   r   r   ÚassertIsInstancer    r7   rí   rî   s       r#   Ú%test_formatUnformattableWithTracebackz6EventAsTextTests.test_formatUnformattableWithTracebackÜ  sË   € ð
	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøð %Ø!�Mð
ð 
ˆð  !ˆˆmÑÝ ¸ÈEÐRÑRÔRˆ	Ø×Ò˜i­Ñ-Ô-Ð-Ø�Š•c˜!Ÿ.š.Ñ*Ô*Ñ+Ô+¨YÑ7Ô7Ð7Ø�ŠÐ,¨iÑ8Ô8Ð8Ð8Ð8rò   c           	      óØ  — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wdddd„ t          t          t	          ¦   «         ¦  «        di}||d<   t          |dd	¬
¦  «        }|                      |t          ¦  «         |                      d|¦  «         |                      t          |                     ¦   «         ¦  «        |¦  «         |                      d|¦  «         dS )z²
        An event with an unformattable value in the C{log_format} key, that
        throws an exception when __repr__ is invoked still has a traceback
        appended.
        ræ   r   r^   rb   c                  ó   — ddz  S r`   r-   r-   r%   r#   r.   zMEventAsTextTests.test_formatUnformattableErrorWithTraceback.<locals>.<lambda>ý  rf   r%   rg   rè   TFré   zMESSAGE LOSTN)	râ   r   r   r    rk   r   r÷   r7   rí   rî   s       r#   Ú*test_formatUnformattableErrorWithTracebackz;EventAsTextTests.test_formatUnformattableErrorWithTracebackð  sñ   € ð	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøð ˜*Ø�M�MÝ••m‘o”oÑ&Ô&¨ð
ˆð
  !ˆˆmÑÝ ¸ÈEÐRÑRÔRˆ	Ø×Ò˜i­Ñ-Ô-Ð-Ø�Š�n iÑ0Ô0Ð0Ø�Š•c˜!Ÿ.š.Ñ*Ô*Ñ+Ô+¨YÑ7Ô7Ð7Ø�ŠÐ,¨iÑ8Ô8Ð8Ð8Ð8rò   c                 ó¶   — ddi}t          ¦   «         |d<   t          |dd¬¦  «        }|                      |t          ¦  «         |                      d|¦  «         dS )	zk
        If a traceback cannot be appended, a message indicating this is true
        is appended.
        r   r'   rè   TFré   z'(UNABLE TO OBTAIN TRACEBACK FROM EVENT)N)rU   r   r÷   r    r7   ©r!   r   rð   s      r#   Ú&test_formatEventUnformattableTracebackz7EventAsTextTests.test_formatEventUnformattableTraceback  sa   € ð
 (¨Ð,ˆÝ%™xœxˆˆmÑÝ ¸ÈEÐRÑRÔRˆ	Ø×Ò˜i­Ñ-Ô-Ð-Ø�ŠÐ?ÀÑKÔKÐKÐKÐKr%   c                 ó”   — ddi}t          |dd¬¦  «        }|                      |t          ¦  «         |                      d|¦  «         dS )zY
        An event with no C{log_failure} key will not have a traceback appended.
        r   rç   TFré   N)r   r÷   r    r7   rý   s      r#   Útest_formatEventNonCriticalz,EventAsTextTests.test_formatEventNonCritical  sT   € ð (Ð)EÐFˆÝ ¸ÈEÐRÑRÔRˆ	Ø×Ò˜i­Ñ-Ô-Ð-Ø�ŠÐ2°IÑ>Ô>Ð>Ð>Ð>r%   c                 óð   — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wddi}||d<   t          |dd¬¦  «        }|                      d|¦  «         |                      d|¦  «         d	S )
zU
        An exception message with multibyte characters is properly handled.
        u   â‚¬r   rç   rè   TFré   Ú	TracebackN©râ   r   r   r7   rî   s       r#   Útest_formatTracebackMultibytez.EventAsTextTests.test_formatTracebackMultibyte  s–   € ð	Ý Ñ&Ô&Ð&øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøð (Ð)EÐFˆØ ˆˆmÑÝ ¸ÈEÐRÑRÔRˆ	Ø�Š�e˜YÑ'Ô'Ð'Ø�Š�k 9Ñ-Ô-Ð-Ð-Ð-rò   c                 óð   — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wddi}||d<   t          |dd¬¦  «        }|                      d|¦  «         |                      d	|¦  «         d
S )zj
        An error raised attempting to decode the UTF still produces a
        valid log message.
        s
   ÿþt e s t r   rç   rè   TFré   r  z.CapturedError(b"\xff\xfet\x00e\x00s\x00t\x00")Nr  rî   s       r#   Ú,test_formatTracebackHandlesUTF8DecodeFailurez=EventAsTextTests.test_formatTracebackHandlesUTF8DecodeFailure*  s˜   € ð
	åÐ ?Ñ@Ô@Ð@øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøð (Ð)EÐFˆØ ˆˆmÑÝ ¸ÈEÐRÑRÔRˆ	Ø�Š�k 9Ñ-Ô-Ð-Ø�ŠÐGÈÑSÔSÐSÐSÐSrò   c                 óè   — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wt          d¦  «        }dd|dœ}||d<   t          |ddd¬	¦  «        }|                      |d
¦  «         dS )zq
        If includeSystem is specified as the only option no timestamp or
        traceback are printed.
        ræ   r•   ÚABCDÚfake_system©r   rÁ   r¬   rè   FT©rê   ÚincludeTracebackrë   z[fake_system] ABCDN©râ   r   r
   r   r6   ©r!   rï   r    r   rð   s        r#   Útest_eventAsTextSystemOnlyz+EventAsTextTests.test_eventAsTextSystemOnly;  s¹   € ð
	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøõ Ð8Ñ9Ô9ˆà Ø'Øð
ð 
ˆð
  !ˆˆmÑÝØØ"Ø"Øð	
ñ 
ô 
ˆ	ð 	×ÒØØ ñ	
ô 	
ð 	
ð 	
ð 	
rò   c                 óP  — t           €t          d¦  «        ‚t          | ¦  «         t          d¦  «         	 t	          d¦  «        ‚# t          $ r t          ¦   «         }Y nw xY wt          d¦  «        }dd|dœ}||d	<   t          |d
dd¬¦  «        }|                      |d¦  «         dS )zq
        If includeTimestamp is specified as the only option no system or
        traceback are printed.
        Nr   rŒ   ræ   r•   r  r	  r
  rè   TFr  z2013-09-24T11:40:47+0000 ABCD)	r   r   r	   r   râ   r   r
   r   r6   r  s        r#   Útest_eventAsTextTimestampOnlyz.EventAsTextTests.test_eventAsTextTimestampOnlyW  sè   € õ
 ˆ=ÝÐWÑXÔXÐXå�TÑÔÐÝˆh‰Œˆð	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøõ Ð8Ñ9Ô9ˆà Ø'Øð
ð 
ˆð
  !ˆˆmÑÝØØ!Ø"Øð	
ñ 
ô 
ˆ	ð 	×ÒØØ+ñ	
ô 	
ð 	
ð 	
ð 	
s   ¶A ÁA ÁA c                 óæ   — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wt          d¦  «        }d|dœ}||d<   t          |ddd¬¦  «        }|                      |d	¦  «         d
S )z\
        If includeSystem is specified with a missing system [-#-]
        is used.
        ræ   r•   r  r«   rè   FTr  z
[-#-] ABCDNr  r  s        r#   Útest_eventAsTextSystemMissingz.EventAsTextTests.test_eventAsTextSystemMissingy  s¶   € ð
	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøõ Ð8Ñ9Ô9ˆà Øð
ð 
ˆð  !ˆˆmÑÝØØ"Ø"Øð	
ñ 
ô 
ˆ	ð 	×ÒØØñ	
ô 	
ð 	
ð 	
ð 	
rò   c                 óþ   — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wt          d¦  «        }d|t          j        ddœ}||d<   t          |ddd¬	¦  «        }|                      |d
¦  «         dS )z€
        If includeSystem is specified with a missing system but
        namespace and level are present they are used.
        ræ   r•   r  Útest)r   r¬   rº   rµ   rè   FTr  z[test#info] ABCDN©râ   r   r
   r   Úinfor   r6   r  s        r#   Ú.test_eventAsTextSystemMissingNamespaceAndLevelz?EventAsTextTests.test_eventAsTextSystemMissingNamespaceAndLevel”  s¾   € ð
	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøõ Ð8Ñ9Ô9ˆà ØÝ!œØ#ð	
ð 
ˆð  !ˆˆmÑÝØØ"Ø"Øð	
ñ 
ô 
ˆ	ð 	×ÒØØ!ñ	
ô 	
ð 	
ð 	
ð 	
rò   c                 óü   — 	 t          d¦  «        ‚# t           $ r t          ¦   «         }Y nw xY wt          d¦  «        }d|t          j        dœ}||d<   t          |ddd¬¦  «        }|                      |d	¦  «         d
S )zv
        If includeSystem is specified with a missing system but
        level is present, level is included.
        ræ   r•   r  )r   r¬   rº   rè   FTr  z[-#info] ABCDNr  r  s        r#   Ú&test_eventAsTextSystemMissingLevelOnlyz7EventAsTextTests.test_eventAsTextSystemMissingLevelOnly±  s»   € ð
	ÝÐ 6Ñ7Ô7Ð7øÝð 	ð 	ð 	Ý‘	”	ˆAˆAˆAð	øøøõ Ð8Ñ9Ô9ˆà ØÝ!œð
ð 
ˆð
  !ˆˆmÑÝØØ"Ø"Øð	
ñ 
ô 
ˆ	ð 	×ÒØØñ	
ô 	
ð 	
ð 	
ð 	
rò   rx   )rC   rD   rE   ry   rñ   rô   rø   rû   rþ   r   r  r  r  r  r  r  r  r-   r%   r#   rä   rä   ¸  s+  € € € € € ðð ð
?ð ?ð ?ð ?ð9ð 9ð 9ð 9ð9ð 9ð 9ð 9ð(9ð 9ð 9ð 9ð.	Lð 	Lð 	Lð 	Lð?ð ?ð ?ð ?ð.ð .ð .ð .ðTð Tð Tð Tð"
ð 
ð 
ð 
ð8 
ð  
ð  
ð  
ðD
ð 
ð 
ð 
ð6
ð 
ð 
ð 
ð:
ð 
ð 
ð 
ð 
ð 
r%   rä   )'ry   Útypingr   r   r   r   Útimer   ÚImportErrorÚtwisted.python.failurer   Ú!twisted.python.test.test_tzhelperr	   r
   r   Útwisted.trialr   Útwisted.trial.unittestr   Ú_formatr   r   r   r   r   r   Ú_interfacesr   Ú_levelsr   ÚTestCaser   r{   r¨   rÖ   rk   Ú	Exceptionrâ   rä   r-   r%   r#   ú<module>r'     s·  ððð ð 0Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /ðØÐÐÐÐÐð 
€E€EøØð ð ð Ø€E€E€Eðøøøð +Ð *Ð *Ð *Ð *Ð *Ø IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IÐ IØ "Ð "Ð "Ð "Ð "Ð "Ø +Ð +Ð +Ð +Ð +Ð +ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð #Ð "Ð "Ð "Ð "Ð "Ø Ð Ð Ð Ð Ð ðUJð UJð UJð UJð UJ�hÔ'ñ UJô UJð UJðpROð ROð ROð ROð RO˜(Ô+ñ ROô ROð ROðj~
ð ~
ð ~
ð ~
ð ~
 Ô 1ñ ~
ô ~
ð ~
ðB
ð 
ð 
ð 
ð 
�xÔ(ñ 
ô 
ð 
ð2ð ð ð ð ñ ô ð ðð ð ð ð �Iñ ô ð ðS
ð S
ð S
ð S
ð S
�xÔ(ñ S
ô S
ð S
ð S
ð S
s   � ™#¢#