ó
    ×›‘hg  ã                   ó„   • S r SSKrSSKrSSKJr  SSKJr  SSKJr  SSK	J
r
Jr  SSKJr   " S S	\5      r " S
 S\5      rg)z
Test strerror
é    N)ÚskipIf)ÚECONNABORTED)Úplatform)Ú_ErrorFormatterÚformatError)ÚTestCasec                   ó   • \ rS rSrSrSrg)Ú_MyWindowsExceptioné   zL
An exception type like L{ctypes.WinError}, but available on all platforms.
© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    Ú^C:\Users\psant\Downloads\Noiseback\school\venv\Lib\site-packages\twisted/test/test_strerror.pyr
   r
      s   † ôr   r
   c                   óÂ   • \ rS rSrSr\rSrS rS r	S r
S rS r\" \R                  " 5       S	:g  S
5      S 5       r\" \R                  " 5       S	:g  S
5      S 5       rSrg)ÚErrorFormatingTestsé   z+
Tests for C{_ErrorFormatter.formatError}.
zcorrect message valuec                 ó´   • [        SSS5      nUR                  U R                  5      nU R                  U[        R
                  " U R                  5      5        g)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                 óô   • SnU R                  U R                  U5        [        SSUS05      nUR                  U R                  5      nU R	                  U[
        R                  " U R                  5      5        g)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                 ó¶   • [        SSU R                  U R                  05      nUR                  U R                  5      nU R	                  X R                  5        g)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                 óô   ^ ^• / mUU 4S jn[        SUT R                  S05      nUR                  T R                  5      nT R                  UT R                  5        T R                  TT R                  /5        g)zf
L{_ErrorFormatter.formatError} should return the return value of
C{formatMessage} if it is supplied.
c                 ó>   >• TR                  U 5        TR                  $ ©N)Úappendr+   )Ú	errorCodeÚformatCallsr   s    €€r   ÚformatMessageÚ=ErrorFormatingTests.test_formatMessage.<locals>.formatMessageH   s   ø€ Ø×Ñ˜yÔ)Ø×$Ñ$Ð$r   Nr%   ©r   r   r   r   r+   )r   r4   r   r    r3   s   `   @r   Útest_formatMessageÚ&ErrorFormatingTests.test_formatMessageA   st   ù€ ð
 ˆö	%ô $Ø�- $×"5Ñ"5°Ð!Gó
ˆ	ð ×'Ñ'¨×(;Ñ(;Ó<ˆØ×Ñ˜ $×"3Ñ"3Ô4Ø×Ñ˜ t×':Ñ':Ð&;Õ<r   c                 ó¼   ^ ^• / mU U4S jn[        US T R                  S05      nUR                  T R                  5      nT R                  UT R                  5        g)z‡
L{_ErrorFormatter.formatError} should return the message argument from
the exception L{winError} returns, if L{winError} is supplied.
c                 óR   >• TR                  U 5        [        U TR                  5      $ r0   )r1   r
   r+   )r2   r   ÚwinCallss    €€r   ÚwinErrorÚ3ErrorFormatingTests.test_winError.<locals>.winErrorZ   s"   ø€ Ø�O‰O˜IÔ&Ü& y°$×2CÑ2CÓDÐDr   c                 ó   • g)NzformatMessage: wrong messager   )r'   s    r   Ú<lambda>Ú3ErrorFormatingTests.test_winError.<locals>.<lambda>`   s   € Ð8r   zerrorTab: wrong messageNr6   )r   r<   r   r    r;   s   `   @r   Útest_winErrorÚ!ErrorFormatingTests.test_winErrorS   s_   ù€ ð
 ˆö	Eô $ØÙ8Ø× Ñ Ð";Ð<ó
ˆ	ð
 ×'Ñ'¨×(;Ñ(;Ó<ˆØ×Ñ˜ $×"3Ñ"3Õ4r   Úwin32zTest will run only on Windows.c                 ó,  • [         R                  " 5       nUR                  bR  SSKJn  U R                  UR                  U R                  5      U" U R                  5      R                  5        SUl        UR                  bH  SSK
Jn  U R                  UR                  U R                  5      U" U R                  5      5        SUl	        UR                  b>  SSKJn  U R                  UR                  U R                  5      X@R                     5        gg)zƒ
L{_ErrorFormatter.fromEnvironment} should create an L{_ErrorFormatter}
instance with attributes populated from available modules.
Nr   ©ÚWinError©ÚFormatMessage)ÚerrorTab)r   ÚfromEnvironmentr<   ÚctypesrF   r   r   r   r   r4   Úwin32apirH   rI   Úsocket)r   r   rF   rH   rI   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                 óN  • [         R                  [           /n SSKJn  UR                  U" [        5      R                  5         SSKJ	n  UR                  U" [        5      5        U R                  [        [        5      U5        g! [         a     NNf = f! [         a     N<f = f)zœ
Given a known-good errno, make sure that formatMessage gives results
matching either C{socket.errorTab}, C{ctypes.WinError}, or
C{win32api.FormatMessage}.
r   rE   rG   N)rM   rI   r   rK   rF   r1   r   ÚImportErrorrL   rH   ÚassertInr   )r   Ú
acceptablerF   rH   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,   r7   rA   r   r   ÚgetTyperN   rT   r   r   r   r   r   r      s…   † ñð "€NØ*€LòDòDò	5ò=ò$5ñ& ˆH×ÒÓ 'Ñ)Ð+KÓLñó MðñB ˆH×ÒÓ 'Ñ)Ð+KÓLñ=ó Mó=r   r   )r   r   rM   Ú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   