AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/twisted/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/twisted/test/__pycache__/test_strerror.cpython-310.pyc
o

�b�@sxdZddlZddlZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
Gdd	�d	e�ZGd
d�de
�ZdS)z
Test strerror
�N)�skipIf)�ECONNABORTED)�platform)�_ErrorFormatter�formatError)�TestCasec@seZdZdZdS)�_MyWindowsExceptionzT
    An exception type like L{ctypes.WinError}, but available on all platforms.
    N)�__name__�
__module__�__qualname__�__doc__�r
r
�</usr/lib/python3/dist-packages/twisted/test/test_strerror.pyrsrc@steZdZdZeZdZdd�Zdd�Zdd�Z	d	d
�Z
dd�Zee
��d
kd�dd��Zee
��d
kd�dd��ZdS)�ErrorFormatingTestsz3
    Tests for C{_ErrorFormatter.formatError}.
    zcorrect message valuecCs0tddd�}|�|j�}|�|t�|j��dS)z�
        L{_ErrorFormatter.formatError} should use L{os.strerror} to format
        error messages if it is constructed without any better mechanism.
        N)rr�probeErrorCode�assertEqual�os�strerror��self�	formatter�messager
r
r�test_strerrorFormatting sz+ErrorFormatingTests.test_strerrorFormattingcCsFd}|�|j|�tdd|di�}|�|j�}|�|t�|j��dS)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)�assertNotEqualrrrrrr)r�errorrrr
r
r�test_emptyErrorTab)s
z&ErrorFormatingTests.test_emptyErrorTabcCs2tdd|j|ji�}|�|j�}|�||j�dS)z�
        L{_ErrorFormatter.formatError} should use C{errorTab} if it is supplied
        and contains the requested error code.
        N)rr�probeMessagerrrr
r
r�
test_errorTab6s
�z!ErrorFormatingTests.test_errorTabcsRg���fdd�}td|�jdi�}|��j�}��|�j�����jg�dS)z~
        L{_ErrorFormatter.formatError} should return the return value of
        C{formatMessage} if it is supplied.
        cs��|��jS�N)�appendr��	errorCode��formatCallsrr
r�
formatMessageHs
z=ErrorFormatingTests.test_formatMessage.<locals>.formatMessageNr�rrrrr)rr&rrr
r$r�test_formatMessageAs�z&ErrorFormatingTests.test_formatMessagecsFg���fdd�}t|dd��jdi�}|��j�}��|�j�dS)z�
        L{_ErrorFormatter.formatError} should return the message argument from
        the exception L{winError} returns, if L{winError} is supplied.
        cs��|�t|�j�Sr )r!rrr"�r�winCallsr
r�winErrorZs
z3ErrorFormatingTests.test_winError.<locals>.winErrorcSsdS)NzformatMessage: wrong messager
)rr
r
r�<lambda>`sz3ErrorFormatingTests.test_winError.<locals>.<lambda>zerrorTab: wrong messageNr')rr+rrr
r)r�
test_winErrorSs�z!ErrorFormatingTests.test_winError�win32zTest will run only on Windows.cCs�t��}|jdur ddlm}|�|�|j�||j�j�d|_|j	dur;ddl
m}|�|�|j�||j��d|_	|jdurUddl
m}|�|�|j�||j�dSdS)z�
        L{_ErrorFormatter.fromEnvironment} should create an L{_ErrorFormatter}
        instance with attributes populated from available modules.
        Nr��WinError��
FormatMessage)�errorTab)r�fromEnvironmentr+�ctypesr0rrrrr&�win32apir2r3�socket)rrr0r2r3r
r
r�test_fromEnvironmentfs,


�

�

��z(ErrorFormatingTests.test_fromEnvironmentcCs�tjtg}zddlm}|�|t�j�Wn	tyYnwzddlm	}|�|t��Wn	ty8Ynw|�
tt�|�dS)z�
        Given a known-good errno, make sure that formatMessage gives results
        matching either C{socket.errorTab}, C{ctypes.WinError}, or
        C{win32api.FormatMessage}.
        rr/r1N)r7r3rr5r0r!r�ImportErrorr6r2�assertInr)r�
acceptabler0r2r
r
r�test_correctLookups�s��z'ErrorFormatingTests.test_correctLookupsN)r	r
rrrrrrrrr(r-rr�getTyper8r<r
r
r
rrs	

!r)rrr7�unittestr�twisted.internet.tcpr�twisted.python.runtimer�twisted.python.win32rr�twisted.trial.unittestr�OSErrorrrr
r
r
r�<module>s

Anon7 - 2022
AnonSec Team