HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_exception_hierarchy.cpython-37.pyc
B

��g��@s�ddlZddlZddlZddlZddlZddlZddlmZGdd�de�ZGdd�de�Z	Gdd�de�Z
Gd	d
�d
e	e
�ZGdd�de
e	�ZGd
d�de�Z
Gdd�dej�ZGdd�dej�ZGdd�dej�Zedkr�e��dS)�N)�EEXISTc@seZdZdS)�
SubOSErrorN)�__name__�
__module__�__qualname__�rr�9/usr/local/lib/python3.7/test/test_exception_hierarchy.pyr
srcseZdZ�fdd�Z�ZS)�SubOSErrorWithInitcs||_t��|�dS)N)�bar�super�__init__)�self�messager
)�	__class__rrrszSubOSErrorWithInit.__init__)rrrr�
__classcell__rr)rrr	
sr	cseZdZ�fdd�Z�ZS)�SubOSErrorWithNewcst��||�}||_|S)N)r�__new__�baz)�clsrrr
)rrrrszSubOSErrorWithNew.__new__)rrrrrrr)rrrsrc@seZdZdS)�SubOSErrorCombinedInitFirstN)rrrrrrrrsrc@seZdZdS)�SubOSErrorCombinedNewFirstN)rrrrrrrrsrc@seZdZdd�ZdS)�SubOSErrorWithStandaloneInitcCsdS)Nr)r
rrrrsz%SubOSErrorWithStandaloneInit.__init__N)rrrrrrrrrsrc@sHeZdZdd�Zdd�Zdd�ZdZdd	�Zee�Zd
d�Z	dd
�Z
dS)�
HierarchyTestcCs*|�tjd�|�tt�|�tt�dS)N�OSError)�assertEqualrr�assertIs�IOError�EnvironmentError)r
rrr�test_builtin_errors%sz!HierarchyTest.test_builtin_errorscCsB|�tjt�|�tjjt�|�tjjt�|�tjjt�dS)N)	r�socket�errorrZgaierror�__base__rZherrorZtimeout)r
rrr�test_socket_errors*sz HierarchyTest.test_socket_errorscCs|�tjt�dS)N)r�selectr r)r
rrr�test_select_error0szHierarchyTest.test_select_errorae
        +-- BlockingIOError        EAGAIN, EALREADY, EWOULDBLOCK, EINPROGRESS
        +-- ChildProcessError                                          ECHILD
        +-- ConnectionError
            +-- BrokenPipeError                              EPIPE, ESHUTDOWN
            +-- ConnectionAbortedError                           ECONNABORTED
            +-- ConnectionRefusedError                           ECONNREFUSED
            +-- ConnectionResetError                               ECONNRESET
        +-- FileExistsError                                            EEXIST
        +-- FileNotFoundError                                          ENOENT
        +-- InterruptedError                                            EINTR
        +-- IsADirectoryError                                          EISDIR
        +-- NotADirectoryError                                        ENOTDIR
        +-- PermissionError                                     EACCES, EPERM
        +-- ProcessLookupError                                          ESRCH
        +-- TimeoutError                                            ETIMEDOUT
    cCsli}xb|��D]V}|�d�}|s"q|�d�\}}}x0td|���d��D]}tt|�|tt|�<qHWqW|S)Nz+- � z, )�
splitlines�strip�	partition�filter�split�getattr�builtins�errno)�s�_map�lineZexcname�_ZerrnamesZerrnamerrr�	_make_mapFs
zHierarchyTest._make_mapcCs�ttd�}|�t|�t�x0|j��D]"\}}t|d�}|�t|�|�q&Wttj	�t|j�}x&|D]}t|d�}|�t|�t�qfWdS)NzBad file descriptorzSome message)
rrr�type�FileExistsErrorr/�items�setr-�	errorcode)r
�eZerrcode�excZ
othercodesrrr�test_errno_mappingRs



z HierarchyTest.test_errno_mappingcCstd}yt|�Wntk
r$YnX|�d�|�tj�|��yt�|�Wntk
rdYnX|�d�dS)NZ some_hopefully_non_existing_filez&should have raised a FileNotFoundError)�open�FileNotFoundErrorZfailZassertFalse�os�path�exists�unlink)r
�filenamerrr�test_try_except`s
zHierarchyTest.test_try_exceptN)rrrrr"r$Z_pep_mapr2r/r:rBrrrrr#s
rc@s>eZdZdd�Zdd�Ze�ejdkd�dd��Z	d	d
�Z
dS)�AttributesTestcCs0tjdkr|�dtt��n|�dtt��dS)N�nt�winerror)r=�nameZassertIn�dirrZassertNotIn)r
rrr�test_windows_errorzs
z!AttributesTest.test_windows_errorcCsdttdd�}|�|jt�|�|jdt�|�|jd�|�|jd�tjdkr`|�|j	d�dS)NzFile already existszfoo.txtrrD)
rrrr-�args�strerrorrAr=rFrE)r
r8rrr�test_posix_error�s
zAttributesTest.test_posix_errorrDzWindows-specific testcCs\tdddd�}|�|jd�|�|jt�|�|jdt�|�|jd�|�|jd�dS)NrzFile already existszfoo.txt�)rrrEr-rrIrJrA)r
r8rrr�test_errno_translation�sz%AttributesTest.test_errno_translationc
Cstd}x<td�D]0}t|d|��}|�t��|jWdQRXqWtddd�}|�|jd�d|_|�|jd�dS)N)�a�b�c�dr8�rNrO��)�range�BlockingIOErrorZassertRaises�AttributeError�characters_writtenr)r
rI�nr8rrr�test_blockingioerror�sz#AttributesTest.test_blockingioerrorN)rrrrHrK�unittestZ
skipUnlessr=rFrMrZrrrrrCxs	
rCc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�ExplicitSubclassingTestcCsttd�}|�t|�t�dS)NzBad file descriptor)rrrr3)r
r8rrrr:�s
z*ExplicitSubclassingTest.test_errno_mappingcCs*tdd�}|�|jd�|�|jd�dS)Nzsome messager)zsome message)r	rr
rI)r
r8rrr�test_init_overridden�s
z,ExplicitSubclassingTest.test_init_overriddencCs,tddd�}|�|jd�|�|jd�dS)Nzsome messager)r
)zsome message)r	rr
rI)r
r8rrr�test_init_kwdargs�sz)ExplicitSubclassingTest.test_init_kwdargscCs*tdd�}|�|jd�|�|jd�dS)Nzsome messager)zsome message)rrrrI)r
r8rrr�test_new_overridden�s
z+ExplicitSubclassingTest.test_new_overriddencCs,tddd�}|�|jd�|�|jd�dS)Nzsome messager)r)zsome message)rrrrI)r
r8rrr�test_new_kwdargs�sz(ExplicitSubclassingTest.test_new_kwdargscCsltdd�}|�|jd�|�|jd�|�|jd�tdd�}|�|jd�|�|jd�|�|jd�dS)Nzsome messager)zsome message)rrr
rrIr)r
r8rrr�test_init_new_overridden�s

z0ExplicitSubclassingTest.test_init_new_overriddencCs(t�}|�|jd�|�t|�d�dS)Nr�)rrrI�str)r
r8rrr�test_init_standalone�sz,ExplicitSubclassingTest.test_init_standaloneN)
rrrr:r]r^r_r`rardrrrrr\�s
r\�__main__)r,r=r#rr[r-rrrr	rrrrZTestCaserrCr\r�mainrrrr�<module>s"U',