Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/test_pep3151.cpython-34.pyc

�
g f;�@soddlZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	Gdd�de
�ZGdd�de
�ZGdd	�d	e
�Z
Gd
d�dee
�ZGdd
�d
e
e�ZGdd�de
�ZGdd�dej�ZGdd�dej�ZGdd�dej�Zdd�Zedkrke�ndS)�N)�EEXIST)�supportc@seZdZdS)�
SubOSErrorN)�__name__�
__module__�__qualname__�rr�6/opt/alt/python34/lib64/python3.4/test/test_pep3151.pyrsrcs"eZdZ�fdd�Z�S)�SubOSErrorWithInitcs||_t�j|�dS)N)�bar�super�__init__)�self�messager)�	__class__rr	r
s	zSubOSErrorWithInit.__init__)rrrr
rr)rr	r
sr
cs"eZdZ�fdd�Z�S)�SubOSErrorWithNewcs"t�j||�}||_|S)N)r�__new__�baz)�clsrrr)rrr	rs	zSubOSErrorWithNew.__new__)rrrrrr)rr	rsrc@seZdZdS)�SubOSErrorCombinedInitFirstN)rrrrrrr	rsrc@seZdZdS)�SubOSErrorCombinedNewFirstN)rrrrrrr	rsrc@seZdZdd�ZdS)�SubOSErrorWithStandaloneInitcCsdS)Nr)rrrr	r
!sz%SubOSErrorWithStandaloneInit.__init__N)rrrr
rrrr	r src@sjeZdZdd�Zdd�Zdd�ZdZdd	�Zee�Zd
d�Z	dd
�Z
dS)�
HierarchyTestcCs7|jtjd�|jtt�|jtt�dS)N�OSError)�assertEqualrr�assertIs�IOError�EnvironmentError)rrrr	�test_builtin_errors'sz!HierarchyTest.test_builtin_errorscCsY|jtjt�|jtjjt�|jtjjt�|jtjjt�dS)N)	r�socket�errorrZgaierror�__base__rZherrorZtimeout)rrrr	�test_socket_errors,sz HierarchyTest.test_socket_errorscCs|jtjt�dS)N)r�selectr r)rrrr	�test_select_error2szHierarchyTest.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�}|s4qn|jd�\}}}xBtd|j�jd��D]"}tt|�|tt|�<qkWqW|S)Nz+- � z, )�
splitlines�strip�	partition�filter�split�getattr�builtins�errno)�s�_map�lineZexcname�_ZerrnamesZerrnamerrr	�	_make_mapHs%$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_mappingTs
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_exceptbs


zHierarchyTest.test_try_exceptN)rrrrr"r$Z_pep_mapr2r/r:rBrrrr	r%s
rc@s[eZdZdd�Zdd�Zejejdkd�dd��Z	d	d
�Z
dS)�AttributesTestcCsBtjdkr(|jdtt��n|jdtt��dS)N�nt�winerror)r=�nameZassertIn�dirrZassertNotIn)rrrr	�test_windows_error|sz!AttributesTest.test_windows_errorcCs�ttdd�}|j|jt�|j|jdt�|j|jd�|j|jd�tjdkr�|j|j	d�ndS)NzFile already existszfoo.txtrrD)
rrrr-�args�strerrorrAr=rFrE)rr8rrr	�test_posix_error�szAttributesTest.test_posix_errorrDzWindows-specific testcCs|tdddd�}|j|jd�|j|jt�|j|jdt�|j|jd�|j|jd�dS)NrzFile already existszfoo.txt�)rrrEr-rrIrJrA)rr8rrr	�test_errno_translation�sz%AttributesTest.test_errno_translationc	Cs�d	}xGtd�D]9}t|d|��}|jt��|jWdQXqWtddd�}|j|jd�d|_|j|jd�dS)
N�a�b�c�dr8���)rNrOrPrQr8)�range�BlockingIOErrorZassertRaises�AttributeError�characters_writtenr)rrI�nr8rrr	�test_blockingioerror�s	z#AttributesTest.test_blockingioerrorN)rrrrHrK�unittestZ
skipUnlessr=rFrMrZrrrr	rCzs	'
rCc@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�ExplicitSubclassingTestcCs)ttd�}|jt|�t�dS)NzBad file descriptor)rrrr3)rr8rrr	r:�sz*ExplicitSubclassingTest.test_errno_mappingcCs9tdd�}|j|jd�|j|jd�dS)N�some messager)r])r
rrrI)rr8rrr	�test_init_overriden�sz+ExplicitSubclassingTest.test_init_overridencCs<tddd�}|j|jd�|j|jd�dS)N�some messagerr)r_)r
rrrI)rr8rrr	�test_init_kwdargs�sz)ExplicitSubclassingTest.test_init_kwdargscCs9tdd�}|j|jd�|j|jd�dS)N�some messager)ra)rrrrI)rr8rrr	�test_new_overriden�sz*ExplicitSubclassingTest.test_new_overridencCs<tddd�}|j|jd�|j|jd�dS)N�some messager)rc)rrrrI)rr8rrr	�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)re)re)rrrrrIr)rr8rrr	�test_init_new_overriden�sz/ExplicitSubclassingTest.test_init_new_overridencCs6t�}|j|jf�|jt|�d�dS)N�)rrrI�str)rr8rrr	�test_init_standalone�s	z,ExplicitSubclassingTest.test_init_standaloneN)
rrrr:r^r`rbrdrfrirrrr	r\�s
r\cCstjt�dS)N)rZrun_unittestrrrrr	�	test_main�srj�__main__)r,r=r#r�sysr[r-rZtestrrrr
rrrrZTestCaserrCr\rjrrrrr	�<module>s(U',