Current File : //proc/self/root/lib/python3/dist-packages/twisted/test/__pycache__/test_strerror.cpython-312.pyc |
�
Ϫ�fg � � � d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m
Z
mZ ddlm
Z
G d� d e� Z G d
� de
� Zy)z
Test strerror
� N)�skipIf)�ECONNABORTED)�platform)�_ErrorFormatter�formatError)�TestCasec � � e Zd ZdZy)�_MyWindowsExceptionzT
An exception type like L{ctypes.WinError}, but available on all platforms.
N)�__name__�
__module__�__qualname__�__doc__� � �</usr/lib/python3/dist-packages/twisted/test/test_strerror.pyr
r
s � �r r
c � � e Zd ZdZeZdZd� Zd� Zd� Z d� Z
d� Z e e
j � dk7 d � d
� � Z e e
j � dk7 d � d� � Zy)
�ErrorFormatingTestsz3
Tests for C{_ErrorFormatter.formatError}.
zcorrect message valuec � � t ddd� }|j | j � }| j |t j
| j � � y)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_strerrorFormattingz+ErrorFormatingTests.test_strerrorFormatting sG � �
$�D�$��5� ��'�'��(;�(;�<������"�+�+�d�.A�.A�"B�Cr c �� � d}| j | j |� t dd|di� }|j | j � }| j |t j | j � � y)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_emptyErrorTabz&ErrorFormatingTests.test_emptyErrorTab) sg � � �����D�/�/��7�#�D�$���0H�I� ��'�'��(;�(;�<������"�+�+�d�.A�.A�"B�Cr c � � t dd| j | j i� }|j | j � }| j || j � y)z�
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_errorTabz!ErrorFormatingTests.test_errorTab6 sT � �
$��$��,�,�d�.?�.?�@�
� � �'�'��(;�(;�<������$�"3�"3�4r c �� � �� g ��� fd�}t d|� j di� }|j � j � }� j |� j � � j �� j g� y)z~
L{_ErrorFormatter.formatError} should return the return value of
C{formatMessage} if it is supplied.
c �>