Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_pep3151.cpython-35.opt-1.pyc



��Yf��@sSddlZddlZddlZddlZddlZddlZddlZddlmZGdd�de�Z	Gdd�de�Z
Gdd�de�ZGd	d
�d
e
e�ZGdd�dee
�Z
Gd
d�de�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZedkrOej�dS)�N)�EEXISTc@seZdZdS)�
SubOSErrorN)�__name__�
__module__�__qualname__�rr�6/opt/alt/python35/lib64/python3.5/test/test_pep3151.pyrsrcs"eZdZ�fdd�Z�S)�SubOSErrorWithInitcs||_t�j|�dS)N)�bar�super�__init__)�self�messager
)�	__class__rrrs	zSubOSErrorWithInit.__init__)rrrrrr)rrr	sr	cs"eZdZ�fdd�Z�S)�SubOSErrorWithNewcs"t�j||�}||_|S)N)r�__new__�baz)�clsrrr
)rrrrs	zSubOSErrorWithNew.__new__)rrrrrr)rrrsrc@seZdZdS)�SubOSErrorCombinedInitFirstN)rrrrrrrrsrc@seZdZdS)�SubOSErrorCombinedNewFirstN)rrrrrrrrsrc@seZdZdd�ZdS)�SubOSErrorWithStandaloneInitcCsdS)Nr)r
rrrr sz%SubOSErrorWithStandaloneInit.__init__N)rrrrrrrrrsrc@sjeZdZdd�Zdd�Zdd�ZdZdd	�Zee�Zd
d�Z	dd
�Z
dS)�
HierarchyTestcCs7|jtjd�|jtt�|jtt�dS)N�OSError)�assertEqualrr�assertIs�IOError�EnvironmentError)r
rrr�test_builtin_errors&sz!HierarchyTest.test_builtin_errorscCsY|jtjt�|jtjjt�|jtjjt�|jtjjt�dS)N)	r�socket�errorrZgaierror�__base__rZherrorZtimeout)r
rrr�test_socket_errors+sz HierarchyTest.test_socket_errorscCs|jtjt�dS)N)r�selectrr)r
rrr�test_select_error1szHierarchyTest.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
    cCs�i}x�|j�D]{}|jd�}|s1q|jd�\}}}xBtd|j�jd��D]"}tt|�|tt|�<qhWqW|S)Nz+- � z, )�
splitlines�strip�	partition�filter�split�getattr�builtins�errno)�s�_map�lineZexcname�_ZerrnamesZerrnamerrr�	_make_mapGs%$zHierarchyTest._make_mapcCs�ttd�}|jt|�t�xB|jj�D]1\}}t|d�}|jt|�|�q5Wttj	�t|j�}x3|D]+}t|d�}|jt|�t�q�WdS)NzBad file descriptorzSome message)
rrr�type�FileExistsErrorr.�items�setr,�	errorcode)r
�eZerrcode�excZ
othercodesrrr�test_errno_mappingSs
z HierarchyTest.test_errno_mappingcCs�d}yt|�Wntk
r(YnX|jd�|jtjj|��ytj|�Wntk
rtYnX|jd�dS)NZ some_hopefully_non_existing_filez&should have raised a FileNotFoundError)�open�FileNotFoundErrorZfailZassertFalse�os�path�exists�unlink)r
�filenamerrr�test_try_exceptas


zHierarchyTest.test_try_exceptN)rrrrr!r#Z_pep_mapr1r.r9rArrrrr$s
rc@s[eZdZdd�Zdd�Zejejdkd�dd��Z	d	d
�Z
dS)�AttributesTestcCsBtjdkr(|jdtt��n|jdtt��dS)N�nt�winerror)r<�nameZassertIn�dirrZassertNotIn)r
rrr�test_windows_error{sz!AttributesTest.test_windows_errorcCs�ttdd�}|j|jt�|j|jdt�|j|jd�|j|jd�tjdkr�|j|j	d�dS)NzFile already existszfoo.txtrrC)
rrrr,�args�strerrorr@r<rErD)r
r7rrr�test_posix_error�szAttributesTest.test_posix_errorrCzWindows-specific testcCs|tdddd�}|j|jd�|j|jt�|j|jdt�|j|jd�|j|jd�dS)NrzFile already existszfoo.txt�)rrrDr,rrHrIr@)r
r7rrr�test_errno_translation�sz%AttributesTest.test_errno_translationc
Cs�d	}xHtd�D]:}t|d|��}|jt��|jWdQRXqWtddd�}|j|jd�d|_|j|jd�dS)
N�a�b�c�dr7���)rMrNrOrPr7)�range�BlockingIOErrorZassertRaises�AttributeError�characters_writtenr)r
rH�nr7rrr�test_blockingioerror�s	z#AttributesTest.test_blockingioerrorN)rrrrGrJ�unittestZ
skipUnlessr<rErLrYrrrrrBys	'
rBc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�ExplicitSubclassingTestcCs)ttd�}|jt|�t�dS)NzBad file descriptor)rrrr2)r
r7rrrr9�sz*ExplicitSubclassingTest.test_errno_mappingcCs9tdd�}|j|jd�|j|jd�dS)N�some messager)r\)r	rr
rH)r
r7rrr�test_init_overridden�sz,ExplicitSubclassingTest.test_init_overriddencCs<tddd�}|j|jd�|j|jd�dS)N�some messager
r)r^)r	rr
rH)r
r7rrr�test_init_kwdargs�sz)ExplicitSubclassingTest.test_init_kwdargscCs9tdd�}|j|jd�|j|jd�dS)N�some messager)r`)rrrrH)r
r7rrr�test_new_overridden�sz+ExplicitSubclassingTest.test_new_overriddencCs<tddd�}|j|jd�|j|jd�dS)N�some messager)rb)rrrrH)r
r7rrr�test_new_kwdargs�sz(ExplicitSubclassingTest.test_new_kwdargscCs�tdd�}|j|jd�|j|jd�|j|jd�tdd�}|j|jd�|j|jd�|j|jd�dS)N�some messager)rd)rd)rrr
rrHr)r
r7rrr�test_init_new_overridden�sz0ExplicitSubclassingTest.test_init_new_overriddencCs6t�}|j|jf�|jt|�d�dS)N�)rrrH�str)r
r7rrr�test_init_standalone�s	z,ExplicitSubclassingTest.test_init_standaloneN)
rrrr9r]r_rarcrerhrrrrr[�s
r[�__main__)r+r<r"r�sysrZr,rrrr	rrrrZTestCaserrBr[r�mainrrrr�<module>s$U',