a
    §ˆcÚ  ã                   @   s”   d Z ddlmZmZ ddlZddlZddlmZmZm	Z	m
Z
mZ ddlmZmZ ddlmZ G dd„ de	ƒZG d	d
„ d
e	ƒZG dd„ deejƒZdS )z2 General regression tests for various fixed bugs.
é    )Úcheck_outputÚSTDOUTN)ÚDelegatesToÚEventÚ	HasTraitsÚInstanceÚ	Undefined)ÚEditorÚ
TextEditor)ÚBaseTestMixinc                   @   s   e Zd Zeƒ ZdS )ÚParentN)Ú__name__Ú
__module__Ú__qualname__r   Úbutton© r   r   úa/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traitsui/tests/test_regression.pyr      s   r   c                   @   s   e Zd ZeeƒZedƒZdS )ÚChildÚparentN)r   r   r   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 )ÚTestRegressionc                 C   s   t  | ¡ d S ©N)r   ÚsetUp©Úselfr   r   r   r   $   s    zTestRegression.setUpc                 C   s   t  | ¡ d S r   )r   ÚtearDownr   r   r   r   r   '   s    zTestRegression.tearDownc                 C   s0   t tƒ d�}tdtƒ |dd�}|  |jt¡ dS )z<Make sure that DelegatesTo on Events passes Editor creation.)r   Nr   ©ÚfactoryÚobjectÚname)r   r   r	   r
   ZassertIsÚ	old_valuer   )r   ÚchildZeditorr   r   r   Ú!test_editor_on_delegates_to_event*   s
    
ÿz0TestRegression.test_editor_on_delegates_to_eventc                 C   s   | j ttdtƒ tƒ dd� dS )z;Make sure genuine AttributeErrors raise on Editor creation.NZnot_a_traitr   )ÚassertRaisesÚAttributeErrorr	   r
   r   r   r   r   r   Útest_attribute_error2   s    úz#TestRegression.test_attribute_errorc                 C   s0   t tjddgtd�}| d¡}|  d|v ¡ d S )Nz-czJimport sys; from traitsui.view import View;print(list(sys.modules.keys())))ÚstderrÚasciiZQtCore)r   ÚsysÚ
executabler   ÚdecodeZassertFalse)r   Úoutputr   r   r   Ú+test_importing_view_does_not_import_toolkit=   s    ÿü
z:TestRegression.test_importing_view_does_not_import_toolkitN)r   r   r   r   r   r!   r$   r+   r   r   r   r   r   #   s
   r   )Ú__doc__Ú
subprocessr   r   r'   ZunittestZ
traits.apir   r   r   r   r   Ztraitsui.apir	   r
   Ztraitsui.tests._toolsr   r   r   ZTestCaser   r   r   r   r   Ú<module>   s   