
    tf{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##d6llC(((    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   Snchezs   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[[__---EU ; ;<<<KK+]]   	
 	
 	
 	t{{3D'E'EFFF.M0J0JKKKkk.Gk<<&444$w--  cCi')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;;'=EEGG;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         %)Te%?%?%?FD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 	@ 	@ 	@ 	KK=		   	
 	
 	
 	
 	
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^     aQ777U##.777d5kk6*****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d5kk6*****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~    
 *MMmoo&&

 U##BFKKK)62224f=====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##BFKKK)62224f=====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]__1U1UVVBFKKKd=))E1DLL@&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     $KKK>??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$,SM
	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Dc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-     	MdCCCX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     MOO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??;;;  #	
 	
 	
 	/>>1J1J1J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    1q5zz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 	 	 			AAA	 ()EF mERRR	c!..**++Y7772I>>>>>    ,,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 	 	 			AAA	', 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 	 	 			AAA	 %!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 	 	 			AAA	 *MMmoo&&

  !mERRR	i---ni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    
 (,%xx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---2I>>>>>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    	&&& 	 	 			AAA	 ()EF mERRR	eY'''k9-----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    
	 ?@@@ 	 	 			AAA	 ()EF mERRR	k9---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 	 	 			AAA	 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 	 	 			AAA	 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 	 	 			AAA	 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 	 	 			AAA	 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 	 	 			AAA	 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 / / / / / / / / / / / 
EE   EEE + * * * * * 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    ##