Your IP : 216.73.216.85


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-2.pyc



���]��@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�1/opt/alt/python35/lib64/python3.5/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�errorr�gaierror�__base__r�herror�timeout)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�line�excname�_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�FileExistsErrorr1�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_mapr5r1r=rErrrrr$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.txtrrG)
rrrr/�args�strerrorrDr@rIrH)r
r;rrr�test_posix_error�szAttributesTest.test_posix_errorrGzWindows-specific testcCs|tdddd�}|j|jd�|j|jt�|j|jdt�|j|jd�|j|jd�dS)NrzFile already existszfoo.txt�)rrrHr/rrLrMrD)r
r;rrr�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�dr;���)rQrRrSrTr;)�range�BlockingIOErrorZassertRaises�AttributeError�characters_writtenr)r
rL�nr;rrr�test_blockingioerror�s	z#AttributesTest.test_blockingioerrorN)rrrrKrN�unittestZ
skipUnlessr@rIrPr]rrrrrFys	'
rFc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�ExplicitSubclassingTestcCs)ttd�}|jt|�t�dS)NzBad file descriptor)rrrr6)r
r;rrrr=�sz*ExplicitSubclassingTest.test_errno_mappingcCs9tdd�}|j|jd�|j|jd�dS)N�some messager)r`)r	rr
rL)r
r;rrr�test_init_overridden�sz,ExplicitSubclassingTest.test_init_overriddencCs<tddd�}|j|jd�|j|jd�dS)N�some messager
r)rb)r	rr
rL)r
r;rrr�test_init_kwdargs�sz)ExplicitSubclassingTest.test_init_kwdargscCs9tdd�}|j|jd�|j|jd�dS)N�some messager)rd)rrrrL)r
r;rrr�test_new_overridden�sz+ExplicitSubclassingTest.test_new_overriddencCs<tddd�}|j|jd�|j|jd�dS)N�some messager)rf)rrrrL)r
r;rrr�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)rh)rh)rrr
rrLr)r
r;rrr�test_init_new_overridden�sz0ExplicitSubclassingTest.test_init_new_overriddencCs6t�}|j|jf�|jt|�d�dS)N�)rrrL�str)r
r;rrr�test_init_standalone�s	z,ExplicitSubclassingTest.test_init_standaloneN)
rrrr=rarcrergrirlrrrrr_�s
r_�__main__)r.r@r%r�sysr^r/rrrr	rrrrZTestCaserrFr_r�mainrrrr�<module>s$U',