+
    üÐjg  ã                   ó†   € R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
Ht ^ RIHt  ! R R]4      t ! R	 R
]4      tR# )z
Test strerror
N)ÚskipIf)ÚECONNABORTED)Úplatform)Ú_ErrorFormatterÚformatError)ÚTestCasec                   ó   € ] tR t^tRtRtR# )Ú_MyWindowsExceptionzL
An exception type like L{ctypes.WinError}, but available on all platforms.
© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r
   ó    Ú</usr/lib/python3/dist-packages/twisted/test/test_strerror.pyr	   r	      s   † õr   r	   c                   óÎ   a € ] tR t^t o Rt]tRtR tR t	R t
R tR t]! ]P                  ! 4       R8g  R	4      R
 4       t]! ]P                  ! 4       R8g  R	4      R 4       tRtV tR# )ÚErrorFormatingTestsz+
Tests for C{_ErrorFormatter.formatError}.
zcorrect message valuec                ó¶   € \        RRR4      pVP                  V P                  4      pV P                  V\        P
                  ! V P                  4      4       R# )z†
L{_ErrorFormatter.formatError} should use L{os.strerror} to format
error messages if it is constructed without any better mechanism.
N)r   r   ÚprobeErrorCodeÚassertEqualÚosÚstrerror©ÚselfÚ	formatterÚmessages   &  r   Útest_strerrorFormattingÚ+ErrorFormatingTests.test_strerrorFormatting    sG   € ô
 $ D¨$°Ó5ˆ	Ø×'Ñ'¨×(;Ñ(;Ó<ˆØ×Ñ˜¤"§+¢+¨d×.AÑ.AÓ"BÖCr   c                óö   € ^pV P                  V P                  V4       \        RRVR/4      pVP                  V P                  4      pV P	                  V\
        P                  ! V P                  4      4       R# )z¸
L{_ErrorFormatter.formatError} should use L{os.strerror} to format
error messages if it is constructed with only an error tab which does
not contain the error code it is called with.
Núwrong message)ÚassertNotEqualr   r   r   r   r   r   )r   Úerrorr   r   s   &   r   Útest_emptyErrorTabÚ&ErrorFormatingTests.test_emptyErrorTab)   sg   € ð ˆà×Ñ˜D×/Ñ/°Ô7Ü# D¨$°¸Ð0HÓIˆ	Ø×'Ñ'¨×(;Ñ(;Ó<ˆØ×Ñ˜¤"§+¢+¨d×.AÑ.AÓ"BÖCr   c                ó¸   € \        RRV P                  V P                  /4      pVP                  V P                  4      pV P	                  W P                  4       R# )zp
L{_ErrorFormatter.formatError} should use C{errorTab} if it is supplied
and contains the requested error code.
N)r   r   ÚprobeMessager   r   r   s   &  r   Útest_errorTabÚ!ErrorFormatingTests.test_errorTab6   sR   € ô
 $Ø�$˜×,Ñ,¨d×.?Ñ.?Ð@ó
ˆ	ð ×'Ñ'¨×(;Ñ(;Ó<ˆØ×Ñ˜×"3Ñ"3Ö4r   c                óö   a a€ . oVV 3R lp\        RVS P                  R/4      pVP                  S P                  4      pS P                  VS P                  4       S P                  SS P                  .4       R# )zf
L{_ErrorFormatter.formatError} should return the return value of
C{formatMessage} if it is supplied.
c                 ó>   <€ SP                  V 4       SP                  # ©N)Úappendr'   )Ú	errorCodeÚformatCallsr   s   &€€r   ÚformatMessageÚ=ErrorFormatingTests.test_formatMessage.<locals>.formatMessageH   s   ø€ Ø×Ñ˜yÔ)Ø×$Ñ$Ð$r   Nr!   ©r   r   r   r   r'   )r   r0   r   r   r/   s   f   @r   Útest_formatMessageÚ&ErrorFormatingTests.test_formatMessageA   st   ù€ ð
 ˆö	%ô $Ø�- $×"5Ñ"5°Ð!Gó
ˆ	ð ×'Ñ'¨×(;Ñ(;Ó<ˆØ×Ñ˜ $×"3Ñ"3Ô4Ø×Ñ˜ t×':Ñ':Ð&;Ö<r   c                ó¾   a a€ . oV V3R lp\        VR S P                  R/4      pVP                  S P                  4      pS P                  VS P                  4       R# )z‡
L{_ErrorFormatter.formatError} should return the message argument from
the exception L{winError} returns, if L{winError} is supplied.
c                 óR   <€ SP                  V 4       \        V SP                  4      # r,   )r-   r	   r'   )r.   r   ÚwinCallss   &€€r   ÚwinErrorÚ3ErrorFormatingTests.test_winError.<locals>.winErrorZ   s"   ø€ Ø�O‰O˜IÔ&Ü& y°$×2CÑ2CÓDÐDr   c                 ó   € R # )zformatMessage: wrong messager
   )r#   s   &r   Ú<lambda>Ú3ErrorFormatingTests.test_winError.<locals>.<lambda>`   s   € Ñ8r   zerrorTab: wrong messageNr2   )r   r8   r   r   r7   s   f   @r   Útest_winErrorÚ!ErrorFormatingTests.test_winErrorS   s_   ù€ ð
 ˆö	Eô $ØÙ8Ø× Ñ Ð";Ð<ó
ˆ	ð
 ×'Ñ'¨×(;Ñ(;Ó<ˆØ×Ñ˜ $×"3Ñ"3Ö4r   Úwin32zTest will run only on Windows.c                ó>  € \         P                  ! 4       pVP                  eS   ^ RIHp V P                  VP                  V P                  4      V! V P                  4      P                  4       RVn        VP                  eI   ^ RI
Hp V P                  VP                  V P                  4      V! V P                  4      4       RVn	        VP                  eD   ^ RIHp V P                  VP                  V P                  4      W@P                  ,          4       R# R# )zƒ
L{_ErrorFormatter.fromEnvironment} should create an L{_ErrorFormatter}
instance with attributes populated from available modules.
N©ÚWinError©ÚFormatMessage)ÚerrorTab)r   ÚfromEnvironmentr8   ÚctypesrB   r   r   r   r   r0   Úwin32apirD   rE   Úsocket)r   r   rB   rD   rE   s   &    r   Útest_fromEnvironmentÚ(ErrorFormatingTests.test_fromEnvironmentf   sì   € ô $×3Ò3Ó5ˆ	à×ÑÒ)Ý'à×ÑØ×%Ñ% d×&9Ñ&9Ó:Ù˜×,Ñ,Ó-×6Ñ6ôð "&ˆIÔà×"Ñ"Ò.Ý.à×ÑØ×%Ñ% d×&9Ñ&9Ó:Ù˜d×1Ñ1Ó2ôð '+ˆIÔ#à×ÑÒ)Ý'à×ÑØ×%Ñ% d×&9Ñ&9Ó:Ø×,Ñ,Õ-öñ *r   c                ó\  € \         P                  \        ,          .p ^ RIHp VP                  V! \        4      P                  4        ^ RIH	p VP                  V! \        4      4       V P                  \        \        4      V4       R#   \         d     LPi ; i  \         d     L?i ; i)zœ
Given a known-good errno, make sure that formatMessage gives results
matching either C{socket.errorTab}, C{ctypes.WinError}, or
C{win32api.FormatMessage}.
rA   rC   N)rI   rE   r   rG   rB   r-   r   ÚImportErrorrH   rD   ÚassertInr   )r   Ú
acceptablerB   rD   s   &   r   Útest_correctLookupsÚ'ErrorFormatingTests.test_correctLookupsˆ   s�   € ô —o‘o¤lÕ3Ð4ˆ
ð	Ý'à×Ñ™h¤|Ó4×=Ñ=Ô>ð	Ý.à×Ñ™m¬LÓ9Ô:ð 	�‰”k¤,Ó/°Ö<øô ô 	Ùð	ûô ô 	Ùð	ús#   ž+B Á
!B ÂBÂBÂB+Â*B+r
   N)r   r   r   r   r   r   r   r'   r   r$   r(   r3   r=   r   r   ÚgetTyperJ   rP   r   Ú__classdictcell__)Ú__classdict__s   @r   r   r      sˆ   ø‡ € ñð "€NØ*€LòDòDò	5ò=ò$5ñ& ˆH×ÒÓ 'Ñ)Ð+KÓLñó MðñB ˆH×ÒÓ 'Ñ)Ð+KÓLñ=ó Mö=r   r   )r   r   rI   Úunittestr   Útwisted.internet.tcpr   Útwisted.python.runtimer   Útwisted.python.win32r   r   Útwisted.trial.unittestr   ÚOSErrorr	   r   r
   r   r   Ú<module>r[      s;   ðñó 
Û Ý å -Ý +ß =Ý +ô˜'ô ôE=˜(ö E=r   