3
8ßL]  ã               @   sž   d dl Z d dlZd dlZyd dlZdZW n ek
r@   dZY nX d dlmZmZm	Z	 G dd„ deƒZ
G dd„ deƒZG d	d
„ d
ejƒZG dd„ dejƒZdS )é    NTF)ÚFileÚ	HasTraitsÚ
TraitErrorc               @   s   e Zd Zedd�ZdS )ÚExampleModelT)ÚexistsN)Ú__name__Ú
__module__Ú__qualname__r   Ú	file_name© r   r   ú:/tmp/pip-install-5sebvq2j/traits/traits/tests/test_file.pyr      s   r   c               @   s   e Zd Zeƒ ZdS )ÚFastExampleModelN)r   r   r	   r   r
   r   r   r   r   r      s   r   c               @   s4   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ ZdS )ÚFileTestCasec             C   s(   t td�}tjj|_tjtjjƒ|_d S )N)r
   )r   Ú__file__ÚosÚpathr
   ÚsixÚ	text_type)ÚselfÚexample_modelr   r   r   Útest_valid_file   s    

zFileTestCase.test_valid_filec                s&   t td�‰ ‡ fdd„}| jt|ƒ d S )N)r
   c                  s
   dˆ _ d S )Nznot_valid_path!#!#!#)r
   r   )r   r   r   Úassign_invalid    s    z6FileTestCase.test_invalid_file.<locals>.assign_invalid)r   r   ÚassertRaisesr   )r   r   r   )r   r   Útest_invalid_file   s    
zFileTestCase.test_invalid_filec                s&   t td�‰ ‡ fdd„}| jt|ƒ d S )N)r
   c                  s   t jjtƒˆ _d S )N)r   r   Údirnamer   r
   r   )r   r   r   r   (   s    z3FileTestCase.test_directory.<locals>.assign_invalid)r   r   r   r   )r   r   r   )r   r   Útest_directory%   s    
zFileTestCase.test_directoryc                s&   t td�‰ ‡ fdd„}| jt|ƒ d S )N)r
   c                  s
   dˆ _ d S )Né   )r
   r   )r   r   r   r   0   s    z6FileTestCase.test_invalid_type.<locals>.assign_invalid)r   r   r   r   )r   r   r   )r   r   Útest_invalid_type-   s    
zFileTestCase.test_invalid_typec             C   s   t td�}d|_d|_d S )N)r
   Ú.)r   r   r   )r   r   r   r   r   Ú	test_fast5   s    
zFileTestCase.test_fastN)r   r   r	   r   r   r   r   r   r   r   r   r   r      s
   r   c               @   s    e Zd Zejedƒdd„ ƒZdS )ÚTestCreateEditorzThis test needs traitsuic             C   sD   t dd�}|jƒ }| j|jdƒ t dd�}|jƒ }| j|jdƒ d S )NT)r   ÚopenFÚsave)r   Zcreate_editorZassertEqualZdialog_style)r   ÚxÚeditorr   r   r   Ú(test_exists_controls_editor_dialog_style=   s    

z9TestCreateEditor.test_exists_controls_editor_dialog_styleN)r   r   r	   ÚunittestZ
skipUnlessÚHAS_TRAITSUIr%   r   r   r   r   r    ;   s   r    )r   r&   r   Ztraitsuir'   ÚImportErrorZ
traits.apir   r   r   r   r   ZTestCaser   r    r   r   r   r   Ú<module>   s   
$