+
    üÐjô[  ã                   óÂ  € R t ^ RIHtHtHtHtHt  ^ RIHt ] ^ RI
Ht ^ RIHtHtHt ^ RIHt ^ RIHt ^RIHtHtHtHtHtHt ^R	IHt ^R
IHt  ! R R]P>                  4      t  ! R R]P>                  4      t! ! R R]P>                  4      t" ! R R]P>                  4      t# ! R R4      t$ ! R R]%4      t& ! R R]P>                  4      t'R#   ]	 d    Rt LÃi ; i)z+
Test cases for L{twisted.logger._format}.
)ÚAnyÚAnyStrÚDictÚOptionalÚcast)ÚtzsetN)ÚFailure)ÚaddTZCleanupÚmktimeÚsetTZ)Úunittest)ÚSkipTest)ÚeventAsTextÚformatEventÚformatEventAsClassicLogTextÚ
formatTimeÚformatUnformattableEventÚformatWithCall)ÚLogEvent)ÚLogLevelc                   óØ   a € ] tR t^"t o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )ÚFormattingTestsz-
Tests for basic event formatting functions.
c                ó,   <€ V ^8„  d   QhRS[ RS[RS[/# ©é   Ú	logFormatÚeventÚreturn)r   ÚobjectÚstr)ÚformatÚ__classdict__s   "€ÚA/usr/lib/python3/dist-packages/twisted/logger/test/test_format.pyÚ__annotate__ÚFormattingTests.__annotate__'   s"   ø€ ÷ 	ñ 	¡ð 	±ð 	¹Cñ 	ó    c                ób   € WR&   \        V4      pV P                  \        V4      \        4       V# )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Útyper   )Úselfr   r   Úresults   &&, r"   r    ÚFormattingTests.format'   s-   € ð (ˆlÑÜ˜UÓ#ˆØ�‰”d˜6“l¤CÔ(Øˆr%   c                ó   <€ V ^8„  d   QhRR/# ©r   r   N© )r    r!   s   "€r"   r#   r$   2   s   ø€ ÷  Sñ  S $ñ  Sr%   c           	     ór  € V P                  RV P                  R4      4       V P                  RV P                  R4      4       V P                  RV P                  RRR7      4       V P                  RV P                  RRR	 R
7      4       V P                  RV P                  R4      4       V P                  RV P                  R4      4       V P                  RRR7      pV P                  RV4       \        \	        R4      4      pV P                  RV,           R,           V P                  RRR7      4       R# )a  
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                  ó   € R # )Úyesr/   r/   r%   r"   Ú<lambda>Ú2FormattingTests.test_formatEvent.<locals>.<lambda>I   s   € ÉUr%   )Ú
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_formatEventÚ FormattingTests.test_formatEvent2   s  € ð" 	×Ñ˜˜TŸ[™[¨Ó-Ô.Ø×Ñ˜˜TŸ[™[¨›_Ô-Ø×Ñ˜ §¡¨E°U Ó ;Ô<Ø×ÑØØ�K‰KØ+¸Á]ð ó ô	
ð 	×Ñ˜ t§{¡{Ð3DÓ'EÔFØ�‰Ð.°·±¸MÓ0JÔKØ—k‘k .°G�kÓ<ˆØ�‰Ð&¨Ô4ä”$�w“-Ó ˆØ�‰�c˜C•i 'Õ)¨4¯;©;°~È¨;Ó+QÖRr%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r$   T   s   ø€ ÷ 
ñ 
 4ñ 
r%   c                ój   €  ! R R4      pV P                  RV P                  RV! 4       R7      4       R# )zY
L{formatEvent} will format PEP 3101 keys containing C{.}s ending with
C{()} as methods.
c                   ó2   a € ] tR t^Zt o V 3R lR ltRtV tR# )Ú0FormattingTests.test_formatMethod.<locals>.Worldc                ó    <€ V ^8„  d   QhRS[ /# ©r   r   ©r   )r    r!   s   "€r"   r#   Ú=FormattingTests.test_formatMethod.<locals>.World.__annotate__[   s   ø€ ÷ ñ ™sñ r%   c                ó   € R # )Úworldr/   ©r*   s   &r"   ÚwhereÚ6FormattingTests.test_formatMethod.<locals>.World.where[   s   € Ùr%   r/   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__rR   Ú__static_attributes__Ú__classdictcell__©r!   s   @r"   ÚWorldrJ   Z   s   ø‡ € ÷ö r%   r[   zhello worldzhello {what.where()})ÚwhatN)r@   r    )r*   r[   s   & r"   Útest_formatMethodÚ!FormattingTests.test_formatMethodT   s1   € ÷	ñ 	ð 	×ÑØ˜4Ÿ;™;Ð'=ÁEÃG˜;ÓLö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r$   b   s   ø€ ÷ 
ñ 
¨tñ 
r%   c                ót   €  ! R R\         4      pV P                  RV P                  RV! 4       R7      4       R# )zC
L{formatEvent} will format subscripts of attributes per PEP 3101.
c                   ó@   a € ] tR t^gt o ]! RRR7      tV 3R ltRtV tR# )Ú>FormattingTests.test_formatAttributeSubscript.<locals>.ExampleÚbarÚqux)ÚfooÚbazc                ó<   <€ V ^8„  d   Qh/ S[ S[S[3,          ;R&   # )r   Úconfig)r   r   )r    r!   s   "€r"   r#   ÚKFormattingTests.test_formatAttributeSubscript.<locals>.Example.__annotate__g   s   ø‡ ‚ Ù™™c˜•NÑ?ò r%   r/   N)	rT   rU   rV   rW   Údictrh   Ú__annotate_func__rX   rY   rZ   s   @r"   ÚExamplerb   g   s   ø‡ € Ù%)¨e¸Ô%?ˆF÷ ƒ r%   rl   zbar quxz+{example.config[foo]} {example.config[baz]})ÚexampleN)r   r@   r    )r*   rl   s   & r"   Útest_formatAttributeSubscriptÚ-FormattingTests.test_formatAttributeSubscriptb   s<   € ô
	@”fô 	@ð 	×ÑØØ�K‰KØ=Ù›	ð ó ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r$   r   s   ø€ ÷ %ñ %¨$ñ %r%   c                óZ   € \        ^^R7      p\        V4      pV P                  RV4       R# )z%
Formatting an event with no format.
)re   rc   r1   N)rj   r   r@   ©r*   r   r+   s   &  r"   Útest_formatEventNoFormatÚ(FormattingTests.test_formatEventNoFormatr   s*   € ô ˜ Ô"ˆÜ˜UÓ#ˆà×Ñ˜˜VÖ$r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r$   {   s   ø€ ÷ +ñ +¨Tñ +r%   c                ó¢   € \        \        4       ^^R7      p\        V4      pV P                  RV4       V P                  \	        V4      V4       R# )z*
Formatting an event with a bogus format.
)r'   re   rc   zLog format must be strN)rj   r   r   rA   rB   rr   s   &  r"   Útest_formatEventWeirdFormatÚ+FormattingTests.test_formatEventWeirdFormat{   s?   € ô ¤£¨a°QÔ7ˆÜ˜UÓ#ˆà�‰Ð.°Ô7Ø�‰”d˜5“k 6Ö*r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r$   …   s   ø€ ÷ +ñ +¨tñ +r%   c                ó’   € \        RR R7      p\        V4      pV P                  RV4       V P                  \        V4      V4       R# )z6
Formatting an event that's just plain out to get us.
ú{evil()}c                  ó   € ^^ ,          # ©é   r/   r/   r%   r"   r7   Ú?FormattingTests.test_formatUnformattableEvent.<locals>.<lambda>‰   s   € ¸¸Q¾r%   )r'   Úevilr;   N)rj   r   rA   rB   rr   s   &  r"   Útest_formatUnformattableEventÚ-FormattingTests.test_formatUnformattableEvent…   s;   € ô  
±Ô?ˆÜ˜UÓ#ˆà�‰Ð.°Ô7Ø�‰”d˜5“k 6Ö*r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r$   �   s   ø€ ÷ >ñ >À4ñ >r%   c           	     óÆ   € RRRR \        \        \        4       4      R/p\        V4      pV P	                  RV4       V P	                  RV4       V P	                  RV4       R	# )
zB
Formatting an unformattable event that has an unformattable key.
r'   r{   r€   c                  ó   € ^^ ,          # r}   r/   r/   r%   r"   r7   ÚSFormattingTests.test_formatUnformattableEventWithUnformattableKey.<locals>.<lambda>•   ó   € ˜A žEr%   Úgurkú*MESSAGE LOST: unformattable object logged:úRecoverable data:úException during formatting:N)r   r   ÚUnformattabler   rA   rr   s   &  r"   Ú1test_formatUnformattableEventWithUnformattableKeyÚAFormattingTests.test_formatUnformattableEventWithUnformattableKey�   s\   € ð
 ˜*Ø‘MÜ””m“oÓ&¨ð
ˆô
 ˜UÓ#ˆØ�‰ÐBÀFÔKØ�‰Ð)¨6Ô2Ø�‰Ð4°fÖ=r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r$   �   s   ø€ ÷ >ñ >ÀTñ >r%   c                ó¶   € \        RR \        4       R7      p\        V4      pV P                  RV4       V P                  RV4       V P                  RV4       R# )úD
Formatting an unformattable event that has an unformattable value.
r{   c                  ó   € ^^ ,          # r}   r/   r/   r%   r"   r7   ÚUFormattingTests.test_formatUnformattableEventWithUnformattableValue.<locals>.<lambda>£   ó   € ˜˜Qžr%   )r'   r€   rˆ   r‰   rŠ   r‹   N)rj   rŒ   r   rA   rr   s   &  r"   Ú3test_formatUnformattableEventWithUnformattableValueÚCFormattingTests.test_formatUnformattableEventWithUnformattableValue�   sR   € ô Ø!ÙÜ“ô
ˆô
 ˜UÓ#ˆØ�‰ÐBÀFÔKØ�‰Ð)¨6Ô2Ø�‰Ð4°fÖ=r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r$   «   s   ø€ ÷ Jñ JÐRVñ Jr%   c                óð   € \        RR RR7      p\        V\        \        \	        4       4      4      pV P                  RV4       V P                  \        R4      R,           \        R4      ,           V4       R# )	r‘   r{   c                  ó   € ^^ ,          # r}   r/   r/   r%   r"   r7   ÚbFormattingTests.test_formatUnformattableEventWithUnformattableErrorOMGWillItStop.<locals>.<lambda>±   r”   r%   Úokay)r'   r€   Úrecoverabler‰   rœ   z = N)rj   r   r   ÚBaseExceptionrŒ   rA   rB   rr   s   &  r"   Ú@test_formatUnformattableEventWithUnformattableErrorOMGWillItStopÚPFormattingTests.test_formatUnformattableEventWithUnformattableErrorOMGWillItStop«   s^   € ô Ø!ÙØô
ˆô *¨%´´mÄ]Ã_Ó1UÓVˆØ�‰ÐBÀFÔKØ�‰”d˜=Ó)¨EÕ1´D¸³LÕ@À&ÖIr%   r/   N)rT   rU   rV   rW   Ú__doc__r    rE   r]   rn   rs   rw   r�   r�   r•   rž   rX   rY   rZ   s   @r"   r   r   "   ss   ø‡ € ñ÷	ð 	÷ Sð  S÷D
ð 
÷
ð 
÷ %ð %÷+ð +÷+ð +÷>ð >÷>ð >÷Jö Jr%   r   c                   ó�   a € ] tR t^ºt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR	 ltV 3R
 lR lt	V 3R lR lt
RtV tR# )ÚTimeFormattingTestsz&
Tests for time formatting functions.
c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   Ú TimeFormattingTests.__annotate__¿   s   ø€ ÷ ñ �tñ r%   c                ó   € \        V 4       R # )N)r	   rQ   s   &r"   ÚsetUpÚTimeFormattingTests.setUp¿   s
   € Ü�TÖr%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r¤   Â   s   ø€ ÷ .
ñ .
°$ñ .
r%   c                ó�   a € \         f   \        R4      hR V 3R llpV! RRR4       V! RRR	4       V! R
RR4       V! RRR4       R# )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.c                óV   € V ^8„  d   QhR\         R\        \         ,          R\         RR/# )r   ÚnameÚexpectedDSTÚexpectedSTDr   N)r   r   )r    s   "r"   r#   ÚJTimeFormattingTests.test_formatTimeWithDefaultFormat.<locals>.__annotate__Ê   s6   € ÷ 
	Dñ 
	DÜð
	DÜ$,¬S¥Mð
	DÜ@Cð
	Dàñ
	Dr%   c                 óÊ   <€ \        V 4       \        R4      pSP                  \        V4      V4       V'       d)   \        R4      pSP                  \        V4      V4       R# R# )é×  N)	r±   r~   é   é    r³   r³   r   r²   r³   )	iÖ  é   é   r³   r³   r³   é   éµ   r~   )r   r
   r@   r   )r¬   r­   r®   ÚlocalSTDÚlocalDSTr*   s   &&&  €r"   ÚtestForTimeZoneÚMTimeFormattingTests.test_formatTimeWithDefaultFormat.<locals>.testForTimeZoneÊ   sT   ø€ ô �$ŒKäÐ>Ó?ˆHØ×ÑœZ¨Ó1°;Ô?çÜ!Ð"CÓD�Ø× Ñ ¤¨HÓ!5°{ÖCñ 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º   s   f r"   Ú test_formatTimeWithDefaultFormatÚ4TimeFormattingTests.test_formatTimeWithDefaultFormatÂ   sn   ø€ ô
 Š=ÜÐWÓXÐX÷
	Dð 
	Dñ 	ØØØ&ô	
ñ 	Ø&Ø&Ø&ô	
ñ 	Ø(Ø&Ø&ô	
ñ 	ØØØ&ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r¤   ò   s   ø€ ÷ =ñ =¨4ñ =r%   c                óv   € V P                  \        R4      R4       V P                  \        RRR7      R4       R# )z<
If C{when} argument is L{None}, we get the default output.
NÚ-Ú!)Údefault©r@   r   rQ   s   &r"   Útest_formatTimeWithNoTimeÚ-TimeFormattingTests.test_formatTimeWithNoTimeò   s0   € ð 	×Ñœ DÓ)¨3Ô/Ø×Ñœ D°#Ô6¸Ö<r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r¤   ù   s   ø€ ÷ Kñ K¨Tñ Kr%   c                ó’   € \        R4      pV P                  \        VRR7      R4       V P                  \        VRRR7      R4       R# )zB
If C{timeFormat} argument is L{None}, we get the default output.
N©Ú
timeFormatrÁ   rÂ   )rÊ   rÃ   ©	iÝ  é	   é   é   é(   é/   r~   i  éÿÿÿÿ©r
   r@   r   ©r*   Úts   & r"   Útest_formatTimeWithNoFormatÚ/TimeFormattingTests.test_formatTimeWithNoFormatù   s?   € ô Ð8Ó9ˆØ×Ñœ A°$Ô7¸Ô=Ø×Ñœ A°$ÀÔDÀcÖJr%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r¤     s   ø€ ÷ Gñ G¸ñ Gr%   c                óV   € \        R4      pV P                  \        VRR7      R4       R# )z"
Alternate time format in output.
z%Y/%WrÉ   z2013/38NrË   rÒ   rÓ   s   & r"   Ú&test_formatTimeWithAlternateTimeFormatÚ:TimeFormattingTests.test_formatTimeWithAlternateTimeFormat  s&   € ô Ð8Ó9ˆØ×Ñœ A°'Ô:¸IÖFr%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   r¤     s   ø€ ÷ Oñ O¨ñ Or%   c                ó@   € V P                  \        RRR7      R4       R# )z 
"%f" supported in time format.
g’?x€„.Az%frÉ   Ú234560NrÄ   rQ   s   &r"   Útest_formatTimePercentFÚ+TimeFormattingTests.test_formatTimePercentF  s   € ð 	×Ñœ M¸dÔCÀXÖNr%   r/   N)rT   rU   rV   rW   r    r¦   r½   rÅ   rÕ   rÙ   rÞ   rX   rY   rZ   s   @r"   r¢   r¢   º   sM   ø‡ € ñ÷ð ÷.
ð .
÷`=ð =÷Kð K÷Gð G÷Oö Or%   r¢   c                   óê   a € ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )ÚClassicLogFormattingTestsi  z8
Tests for classic text log event formatting functions.
c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   Ú&ClassicLogFormattingTests.__annotate__  s   ø€ ÷ 
ñ 
¨ñ 
r%   c                ó¾   € \         f   \        R4      h\        V 4       \        R4       \	        R4      p\        RVR7      pV P                  \        V4      R4       R# )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¼   ÚXYZZY©r'   Úlog_timez%2013-09-24T11:40:47+0000 [-#-] XYZZY
rË   )r   r   r	   r   r
   rj   r@   r   )r*   rÔ   r   s   &  r"   Útest_formatTimeDefaultÚ0ClassicLogFormattingTests.test_formatTimeDefault  sT   € ô Š=ÜÐWÓXÐXä�TÔÜˆhŒäÐ8Ó9ˆÜ °!Ô4ˆØ×ÑÜ'¨Ó.Ø7ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   '  ó   ø€ ÷ 
ñ 
 tñ 
r%   c                ód   € R R lp\        RRR7      pV P                  \        W!R7      R4       R# )	zK
Time is first field.  Custom formatting function is an optional
argument.
c                óF   € V ^8„  d   QhR\         \        ,          R\        /# )r   rÔ   r   )r   Úfloatr   )r    s   "r"   r#   ÚEClassicLogFormattingTests.test_formatTimeCustom.<locals>.__annotate__-  s   € ÷ 	ñ 	œ(¤5�/ð 	¬cñ 	r%   c                 ó   € R V  R 2# )Ú__r/   )rÔ   s   &r"   r   ÚCClassicLogFormattingTests.test_formatTimeCustom.<locals>.formatTime-  s   € Ø˜�s˜"�:Ðr%   rå   i90  ræ   )r   z__12345__ [-#-] XYZZY
N©rj   r@   r   )r*   r   r   s   &  r"   Útest_formatTimeCustomÚ/ClassicLogFormattingTests.test_formatTimeCustom'  s.   € õ	ô  °%Ô8ˆØ×ÑÜ'¨ÔEØ(ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   6  s   ø€ ÷ 
ñ 
 dñ 
r%   c                óV   € \        RRR7      pV P                  \        V4      R4       R# )z*
Namespace is first part of second field.
rå   úmy.namespace)r'   Úlog_namespacez- [my.namespace#-] XYZZY
Nró   ©r*   r   s   & r"   Útest_formatNamespaceÚ.ClassicLogFormattingTests.test_formatNamespace6  s)   € ô  °~ÔFˆØ×ÑÜ'¨Ó.Ø+ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   @  s   ø€ ÷ 
ñ 
 $ñ 
r%   c                ór   € \        R\        P                  R7      pV P                  \	        V4      R4       R# )z'
Level is second part of second field.
rå   )r'   Ú	log_levelz- [-#warn] XYZZY
N©rj   r   Úwarnr@   r   rú   s   & r"   Útest_formatLevelÚ*ClassicLogFormattingTests.test_formatLevel@  s-   € ô  ´8·=±=ÔAˆØ×ÑÜ'¨Ó.Ø#ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   J  ó   ø€ ÷ 
ñ 
 4ñ 
r%   c                óV   € \        RRR7      pV P                  \        V4      R4       R# )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_formatSystemÚ+ClassicLogFormattingTests.test_formatSystemJ  s)   € ô  °NÔCˆØ×ÑÜ'¨Ó.Ø&ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   T  rë   r%   c                óv   € \        RR\        P                  RR7      pV P                  \	        V4      R4       R# )ú2
System is not supplanted by namespace and level.
rå   rø   r  )r'   rù   rÿ   r	  r
  Nr   rú   s   & r"   Útest_formatSystemRulzÚ/ClassicLogFormattingTests.test_formatSystemRulzT  s9   € ô ØØ(Ü—m‘mØ%ô	
ˆð 	×ÑÜ'¨Ó.Ø&ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   c  s   ø€ ÷ 
ñ 
°ñ 
r%   c                óf   € \        R\        4       R7      pV P                  \        V4      R4       R# )r  rå   r  z- [UNFORMATTABLE] XYZZY
N)rj   rŒ   r@   r   rú   s   & r"   Útest_formatSystemUnformattableÚ8ClassicLogFormattingTests.test_formatSystemUnformattablec  s+   € ô  ´M³OÔDˆØ×ÑÜ'¨Ó.Ø'ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   m  r  r%   c                óV   € \        RRR7      pV P                  \        V4      R4       R# )z 
Formatted event is last field.
zid:{id}Ú123©r'   Úidz- [-#-] id:123
Nró   rú   s   & r"   Útest_formatFormatÚ+ClassicLogFormattingTests.test_formatFormatm  s)   € ô  	¨eÔ4ˆØ×ÑÜ'¨Ó.Ø!ö	
r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   w  s   ø€ ÷ @ñ @ Tñ @r%   c                óT   € \        RR7      pV P                  \        V4      R4       R# )z
No format string.
r  )r  N©rj   r(   r   rú   s   & r"   Útest_formatNoFormatÚ-ClassicLogFormattingTests.test_formatNoFormatw  s!   € ô ˜”ˆØ�‰Ô1°%Ó8¸$Ö?r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   ~  s   ø€ ÷ @ñ @¨ñ @r%   c                óV   € \        RRR7      pV P                  \        V4      R4       R# )z
Empty format string.
r1   r  r  Nr  rú   s   & r"   Útest_formatEmptyFormatÚ0ClassicLogFormattingTests.test_formatEmptyFormat~  s$   € ô   uÔ-ˆØ�‰Ô1°%Ó8¸$Ö?r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rã   …  s   ø€ ÷ 
ñ 
¨Dñ 
r%   c                óT   € \        RR7      pV P                  \        V4      R4       R# )z?
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_formatFormatMultiLineÚ4ClassicLogFormattingTests.test_formatFormatMultiLine…  s(   € ô Ð FÔGˆØ×ÑÜ'¨Ó.ØCö	
r%   r/   N)rT   rU   rV   rW   r    rè   rô   rû   r  r  r  r  r  r   r$  r(  rX   rY   rZ   s   @r"   rá   rá     s|   ø‡ € ñ÷
ð 
÷&
ð 
÷
ð 
÷
ð 
÷
ð 
÷
ð 
÷
ð 
÷
ð 
÷@ð @÷@ð @÷
ö 
r%   rá   c                   ó6   a € ] tR tRt o RtV 3R lR ltRtV tR# )ÚFormatFieldTestsi�  z#
Tests for format field functions.
c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   ÚFormatFieldTests.__annotate__•  s   ø€ ÷ 
ñ 
 Tñ 
r%   c           
     ó¤   € V P                  \        R\        RR R7      4      R4       V P                  \        R\        R R7      4      R	4       R
# )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                  ó   € R # )Úmayber/   r/   r%   r"   r7   Ú6FormatFieldTests.test_formatWithCall.<locals>.<lambda>Ÿ  s   € ±7r%   )rP   ÚcallmezHello, earth. maybe.zHello, {repr()!r}.c                  ó   € R # ©rB   r/   r/   r%   r"   r7   r2  ¤  s   € Á6r%   r5  zHello, 'repr'.N)r@   r   rj   rQ   s   &r"   Útest_formatWithCallÚ$FormatFieldTests.test_formatWithCall•  sO   € ð 	×ÑÜØ-Ü˜7©?Ô;óð #ô	
ð 	×ÑÜÐ/´¹>Ô1JÓKØö	
r%   r/   N)rT   rU   rV   rW   r    r6  rX   rY   rZ   s   @r"   r+  r+  �  s   ø‡ € ñ÷
ö 
r%   r+  c                   ó6   a € ] tR tRt o RtV 3R lR ltRtV tR# )rŒ   i©  z6
An object that raises an exception from C{__repr__}.
c                ó    <€ V ^8„  d   QhRS[ /# rL   rM   )r    r!   s   "€r"   r#   ÚUnformattable.__annotate__®  s   ø€ ÷ ñ ™#ñ r%   c                ó&   € \        ^^ ,          4      # r}   rM   rQ   s   &r"   Ú__repr__ÚUnformattable.__repr__®  s   € Ü�1�q•5‹zÐr%   r/   N)rT   rU   rV   rW   r    r<  rX   rY   rZ   s   @r"   rŒ   rŒ   ©  s   ø‡ € ñ÷ö r%   rŒ   c                   ó   € ] tR tRtRtRtR# )ÚCapturedErrori²  z+
A captured error for use in format tests.
r/   N)rT   rU   rV   rW   r    rX   r/   r%   r"   r?  r?  ²  s   † õr%   r?  c                   ó   a € ] tR tRt o RtV 3R lR ltV 3R lR ltV 3R lR ltV 3R	 lR
 ltV 3R lR lt	V 3R lR lt
V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltRtV tR # )!ÚEventAsTextTestsi¸  z]
Tests for L{eventAsText}, all of which ensure that the
returned type is UTF-8 decoded text.
c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   ÚEventAsTextTests.__annotate__¾  s   ø€ ÷ ?ñ ?¨ñ ?r%   c                óö   €  \        R4      h  \          d    \        4       p Mi ; iRR/pYR&   \        TRRR7      pT P                  \	        TP                  4       4      T4       T P                  RT4       R# )	zD
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   rA   r   ÚgetTraceback©r*   Úfr   Ú	eventTexts   &   r"   Útest_eventWithTracebackÚ(EventAsTextTests.test_eventWithTraceback¾  su   € ð	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úð (Ð)EÐFˆØ ˆmÑÜ ¸ÈEÔRˆ	Ø�‰”c˜!Ÿ.™.Ó*Ó+¨YÔ7Ø�‰Ð2°IÖ>ó   ‚ �%¤%c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  Í  s   ø€ ÷ 9ñ 9°Dñ 9r%   c                óö   €  \        R4      h  \          d    \        4       p Mi ; iRR/pYR&   \        TRRR7      pT P                  \	        TP                  4       4      T4       T P                  RT4       R# )	z]
An event with an empty C{log_format} key appends a traceback from
the accompanying failure.
rE  r'   r1   rG  TFrH  NrK  rM  s   &   r"   Ú"test_formatEmptyEventWithTracebackÚ3EventAsTextTests.test_formatEmptyEventWithTracebackÍ  sr   € ð
	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úà'¨Ð,ˆØ ˆmÑÜ ¸ÈEÔRˆ	Ø�‰”c˜!Ÿ.™.Ó*Ó+¨YÔ7Ø�‰Ð,¨iÖ8rR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  Ü  s   ø€ ÷ 9ñ 9°tñ 9r%   c                ó(  €  \        R4      h  \          d    \        4       p Mi ; iRRRR /pYR&   \        TRRR	7      pT P                  T\        4       T P                  \	        TP                  4       4      T4       T P                  RT4       R
# )z_
An event with an unformattable value in the C{log_format} key still
has a traceback appended.
rE  r'   r{   r€   c                  ó   € ^^ ,          # r}   r/   r/   r%   r"   r7   ÚHEventAsTextTests.test_formatUnformattableWithTraceback.<locals>.<lambda>è  r‡   r%   rG  TFrH  N)r?  r   r   ÚassertIsInstancer   rA   rL  rM  s   &   r"   Ú%test_formatUnformattableWithTracebackÚ6EventAsTextTests.test_formatUnformattableWithTracebackÜ  s�   € ð
	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úð ˜*Ø‘Mð
ˆð  !ˆmÑÜ ¸ÈEÔRˆ	Ø×Ñ˜i¬Ô-Ø�‰”c˜!Ÿ.™.Ó*Ó+¨YÔ7Ø�‰Ð,¨iÖ8rR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  ð  s   ø€ ÷ 9ñ 9¸Dñ 9r%   c           	     ó|  €  \        R4      h  \          d    \        4       p Mi ; iRRRR \        \        \	        4       4      R/pYR&   \        TRR	R
7      pT P                  T\        4       T P                  RT4       T P                  \        TP                  4       4      T4       T P                  RT4       R# )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.
rE  r'   r{   r€   c                  ó   € ^^ ,          # r}   r/   r/   r%   r"   r7   ÚMEventAsTextTests.test_formatUnformattableErrorWithTraceback.<locals>.<lambda>ý  r‡   r%   rˆ   rG  TFrH  zMESSAGE LOSTN)	r?  r   r   r   rŒ   r   r[  rA   rL  rM  s   &   r"   Ú*test_formatUnformattableErrorWithTracebackÚ;EventAsTextTests.test_formatUnformattableErrorWithTracebackð  s©   € ð	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úð ˜*Ø‘MÜ””m“oÓ&¨ð
ˆð
  !ˆmÑÜ ¸ÈEÔRˆ	Ø×Ñ˜i¬Ô-Ø�‰�n iÔ0Ø�‰”c˜!Ÿ.™.Ó*Ó+¨YÔ7Ø�‰Ð,¨iÖ8rR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC    s   ø€ ÷ 	Lñ 	L¸ñ 	Lr%   c                ó”   € RR/p\        4       VR&   \        VRRR7      pV P                  V\        4       V P	                  RV4       R# )	zS
If a traceback cannot be appended, a message indicating this is true
is appended.
r'   r1   rG  TFrH  z'(UNABLE TO OBTAIN TRACEBACK FROM EVENT)N)r   r   r[  r   rA   ©r*   r   rO  s   &  r"   Ú&test_formatEventUnformattableTracebackÚ7EventAsTextTests.test_formatEventUnformattableTraceback  sG   € ð
 (¨Ð,ˆÜ%›xˆˆmÑÜ ¸ÈEÔRˆ	Ø×Ñ˜i¬Ô-Ø�‰Ð?ÀÖKr%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC    s   ø€ ÷ ?ñ ?¨Tñ ?r%   c                óz   € RR/p\        VRRR7      pV P                  V\        4       V P                  RV4       R# )zI
An event with no C{log_failure} key will not have a traceback appended.
r'   rF  TFrH  N)r   r[  r   rA   rf  s   &  r"   Útest_formatEventNonCriticalÚ,EventAsTextTests.test_formatEventNonCritical  s<   € ð (Ð)EÐFˆÜ ¸ÈEÔRˆ	Ø×Ñ˜i¬Ô-Ø�‰Ð2°IÖ>r%   c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC    s   ø€ ÷ .ñ .¨tñ .r%   c                óÈ   €  \        R4      h  \          d    \        4       p Mi ; iRR/pYR&   \        TRRR7      pT P                  RT4       T P                  RT4       R	# )
zE
An exception message with multibyte characters is properly handled.
u   â‚¬r'   rF  rG  TFrH  Ú	TracebackN©r?  r   r   rA   rM  s   &   r"   Útest_formatTracebackMultibyteÚ.EventAsTextTests.test_formatTracebackMultibyte  sg   € ð	Ü Ó&Ð&øÜô 	Ü“	ŠAð	úð (Ð)EÐFˆØ ˆmÑÜ ¸ÈEÔRˆ	Ø�‰�e˜YÔ'Ø�‰�k 9Ö-rR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  *  s   ø€ ÷ Tñ T¸dñ Tr%   c                óÈ   €  \        R4      h  \          d    \        4       p Mi ; iRR/pYR&   \        TRRR7      pT P                  RT4       T P                  R	T4       R
# )zR
An error raised attempting to decode the UTF still produces a
valid log message.
s
   ÿþt e s t r'   rF  rG  TFrH  ro  z.CapturedError(b"\xff\xfet\x00e\x00s\x00t\x00")Nrp  rM  s   &   r"   Ú,test_formatTracebackHandlesUTF8DecodeFailureÚ=EventAsTextTests.test_formatTracebackHandlesUTF8DecodeFailure*  si   € ð
	äÐ ?Ó@Ð@øÜô 	Ü“	ŠAð	úð (Ð)EÐFˆØ ˆmÑÜ ¸ÈEÔRˆ	Ø�‰�k 9Ô-Ø�‰ÐGÈÖSrR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  ;  s   ø€ ÷ 
ñ 
¨Dñ 
r%   c                óÄ   €  \        R4      h  \          d    \        4       p Mi ; i\        R4      pRRRRRT/pYR&   \        TRRR	R
7      pT P	                  TR4       R# )zY
If includeSystem is specified as the only option no timestamp or
traceback are printed.
rE  r'   ÚABCDr	  Úfake_systemrç   rG  FT©rI  ÚincludeTracebackrJ  z[fake_system] ABCDNrË   ©r?  r   r
   r   r@   ©r*   rN  rÔ   r   rO  s   &    r"   Útest_eventAsTextSystemOnlyÚ+EventAsTextTests.test_eventAsTextSystemOnly;  s‚   € ð
	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úô Ð8Ó9ˆà˜&Ø˜-Ø˜ð
ˆð
  !ˆmÑÜØØ"Ø"Øô	
ˆ	ð 	×ÑØØ ö	
rR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  W  s   ø€ ÷  
ñ  
¨tñ  
r%   c                ó  € \         f   \        R4      h\        V 4       \        R4        \	        R4      h  \         d    \        4       p Mi ; i\        R4      pRRRRR	T/pYR
&   \        TRRRR7      pT P                  TR4       R# )zY
If includeTimestamp is specified as the only option no system or
traceback are printed.
Nrª   r¼   rE  r'   ry  r	  rz  rç   rG  TFr{  z2013-09-24T11:40:47+0000 ABCDrË   )	r   r   r	   r   r?  r   r
   r   r@   r~  s   &    r"   Útest_eventAsTextTimestampOnlyÚ.EventAsTextTests.test_eventAsTextTimestampOnlyW  s¤   € ô
 Š=ÜÐWÓXÐXä�TÔÜˆhŒð	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úô Ð8Ó9ˆà˜&Ø˜-Ø˜ð
ˆð
  !ˆmÑÜØØ!Ø"Øô	
ˆ	ð 	×ÑØØ+ö	
s   «6 ¶AÁAc                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  y  s   ø€ ÷ 
ñ 
¨tñ 
r%   c                óÀ   €  \        R4      h  \          d    \        4       p Mi ; i\        R4      pRRRT/pYR&   \        TRRRR7      pT P	                  TR	4       R
# )zD
If includeSystem is specified with a missing system [-#-]
is used.
rE  r'   ry  rç   rG  FTr{  z
[-#-] ABCDNrË   r}  r~  s   &    r"   Útest_eventAsTextSystemMissingÚ.EventAsTextTests.test_eventAsTextSystemMissingy  s}   € ð
	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úô Ð8Ó9ˆà˜&Ø˜ð
ˆð  !ˆmÑÜØØ"Ø"Øô	
ˆ	ð 	×ÑØØö	
rR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  ”  s   ø€ ÷ 
ñ 
Àñ 
r%   c                óä   €  \        R4      h  \          d    \        4       p Mi ; i\        R4      pRRRTR\        P                  RR/pYR&   \        TR	R	R
R7      pT P                  TR4       R# )zh
If includeSystem is specified with a missing system but
namespace and level are present they are used.
rE  r'   ry  rç   rÿ   rù   ÚtestrG  FTr{  z[test#info] ABCDNrË   ©r?  r   r
   r   Úinfor   r@   r~  s   &    r"   Ú.test_eventAsTextSystemMissingNamespaceAndLevelÚ?EventAsTextTests.test_eventAsTextSystemMissingNamespaceAndLevel”  s‹   € ð
	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úô Ð8Ó9ˆà˜&Ø˜ØœŸ™Ø˜Vð	
ˆð  !ˆmÑÜØØ"Ø"Øô	
ˆ	ð 	×ÑØØ!ö	
rR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  ±  s   ø€ ÷ 
ñ 
¸ñ 
r%   c                óà   €  \        R4      h  \          d    \        4       p Mi ; i\        R4      pRRRTR\        P                  /pYR&   \        TRRRR	7      pT P                  TR
4       R# )z^
If includeSystem is specified with a missing system but
level is present, level is included.
rE  r'   ry  rç   rÿ   rG  FTr{  z[-#info] ABCDNrË   rŒ  r~  s   &    r"   Ú&test_eventAsTextSystemMissingLevelOnlyÚ7EventAsTextTests.test_eventAsTextSystemMissingLevelOnly±  s†   € ð
	ÜÐ 6Ó7Ð7øÜô 	Ü“	ŠAð	úô Ð8Ó9ˆà˜&Ø˜ØœŸ™ð
ˆð
  !ˆmÑÜØØ"Ø"Øô	
ˆ	ð 	×ÑØØö	
rR  c                ó   <€ V ^8„  d   QhRR/# r.   r/   )r    r!   s   "€r"   r#   rC  Í  s   ø€ ÷ @ñ @¨Tñ @r%   c                óú   € R R lpV P                  \        \        4      V! R\        R7      4       V P                  \        \        4      V! R\        R7      4       V P                  RV! R\        R7      4       R# )zH
C{eventAsText} can handle formats that have classes or types as input.
c                ó<   € V ^8„  d   QhR\         R\        R\         /# r   )r   r   )r    s   "r"   r#   ÚBEventAsTextTests.test_eventAsTextTypeAsInput.<locals>.__annotate__Ò  s!   € ÷ 	ñ 	œsð 	¬Sð 	´Sñ 	r%   c                 ó(   € \        R V /VCRRRR7      # )r'   Fr{  )r   )r   r   s   &,r"   ÚgetTextÚ=EventAsTextTests.test_eventAsTextTypeAsInput.<locals>.getTextÒ  s%   € ÜØ˜yÐ2¨EÐ2Ø!&Ø!&Ø#ô	ð r%   z{c})Úcr   z{c.__name__}N)r@   r   ÚintÚRuntimeError)r*   r™  s   & r"   Útest_eventAsTextTypeAsInputÚ,EventAsTextTests.test_eventAsTextTypeAsInputÍ  sW   € õ
	ð 	×ÑœœS›¡7¨5´CÔ#8Ô9Ø×Ñœœ\Ó*©G°E¼\Ô,JÔKØ×Ñ˜¡¨¼#Ô >Ö?r%   r/   N)rT   rU   rV   rW   r    rP  rU  r\  rb  rg  rk  rq  ru  r  rƒ  r‡  rŽ  r’  rž  rX   rY   rZ   s   @r"   rA  rA  ¸  s�   ø‡ € ñ÷
?ð ?÷9ð 9÷9ð 9÷(9ð 9÷.	Lð 	L÷?ð ?÷.ð .÷Tð T÷"
ð 
÷8 
ð  
÷D
ð 
÷6
ð 
÷:
ð 
÷8@ö @r%   rA  )(r    Útypingr   r   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+  rŒ   Ú	Exceptionr?  rA  r/   r%   r"   Ú<module>r¬     sÚ   ðñ÷ 5Õ 4ðÝñ 
õ +ß IÑ IÝ "Ý +÷÷ õ #Ý ôUJ�h×'Ñ'ô UJôpRO˜(×+Ñ+ô ROôj~
 × 1Ñ 1ô ~
ôB
�x×(Ñ(ô 
÷2ñ ô�Iô ôd@�x×(Ñ(ö d@øðS ô Ø‚Eðús   ’C Ã	CÃC