a
    ¦ˆc²  ã                   @   sP   d dl Z d dlmZ ddlmZ ddlmZ ddlmZ G dd„ de j	eƒZ
dS )	é    N)ÚUnittestToolsé   )ÚAction)Ú
ActionItem)ÚGroupc                   @   s´   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zd)d*„ Zd+S ),ÚTestActionItemc                    s8   g ˆ _ ‡ fdd„}|ˆ _td|d�ˆ _tˆ jd�ˆ _d S )Nc                      s   ˆ j  d¡ d S )NÚcalled)ÚmemoÚappend© ©Úselfr   úa/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/action/tests/test_group.pyÚperform   s    z%TestActionItem.setUp.<locals>.performÚTest)ÚnameÚ
on_perform©Úaction)r	   r   r   r   r   Úaction_item)r   r   r   r   r   ÚsetUp   s
    zTestActionItem.setUpc                 C   s0   t | jƒ}|  |j| jg¡ |  | jj|¡ d S ©N)r   r   ÚassertEqualÚitemsÚparent©r   Úgroupr   r   r   Útest_init_action_item#   s    
z$TestActionItem.test_init_action_itemc                 C   sJ   t | jƒ}|  t|jƒd¡ |  |jd j| j¡ |  |jd j|¡ d S )Né   r   )r   r   r   Úlenr   r   r   r   r   r   Útest_init_action(   s    
zTestActionItem.test_init_actionc                 C   sb   t | jƒ}|  t|jƒd¡ |  |jd jj| j¡ |  |jd jjd¡ |  |jd j|¡ d S )Nr   r   ÚPerform)	r   r   r   r   r   r   r   r   r   r   r   r   r   Útest_init_callable.   s
    
z!TestActionItem.test_init_callablec                 C   s   t ƒ }|  |jg ¡ d S r   )r   r   r   r   r   r   r   Útest_init_nothing5   s    z TestActionItem.test_init_nothingc                 C   sJ   t | jƒ}ttdd�d�}| |¡ |  |j| j|g¡ |  |j|¡ d S ©NúAction 2©r   r   )r   r   r   r   r
   r   r   r   ©r   r   Zaction_item2r   r   r   Útest_append9   s
    

zTestActionItem.test_appendc                 C   sp   t | jƒ}tdd�}| |¡ |  t|jƒd¡ |  |jd | j¡ |  |jd j|¡ |  |jd j|¡ d S )Nr%   r&   r   r   r   )	r   r   r   r
   r   r   r   r   r   ©r   r   Zaction2r   r   r   Útest_append_actionA   s    


z!TestActionItem.test_append_actionc                 C   s‚   t | jƒ}| | j¡ |  t|jƒd¡ |  |jd | j¡ |  |jd jj| j¡ |  |jd jj	d¡ |  |jd j
|¡ d S )Nr   r   r   r!   )r   r   r
   r   r   r   r   r   r   r   r   r   r   r   r   Útest_append_callableK   s    
z#TestActionItem.test_append_callablec                 C   s$   t | jƒ}| ¡  |  |jg ¡ d S r   )r   r   Úclearr   r   r   r   r   r   Ú
test_clearU   s    
zTestActionItem.test_clearc                 C   s(   t | jƒ}| ¡  |  |j| jg¡ d S r   )r   r   Údestroyr   r   r   r   r   r   Útest_destroy]   s    
zTestActionItem.test_destroyc                 C   sL   t | jƒ}ttdd�d�}| d|¡ |  |j| j|g¡ |  |j|¡ d S )Nr%   r&   r   r   ©r   r   r   r   Úinsertr   r   r   r'   r   r   r   Útest_insertd   s
    
zTestActionItem.test_insertc                 C   sr   t | jƒ}tdd�}| d|¡ |  t|jƒd¡ |  |jd | j¡ |  |jd j|¡ |  |jd j|¡ d S )Nr%   r&   r   r   r   )	r   r   r   r1   r   r   r   r   r   r)   r   r   r   Útest_insert_actionl   s    

z!TestActionItem.test_insert_actionc                 C   s„   t | jƒ}| d| j¡ |  t|jƒd¡ |  |jd | j¡ |  |jd jj| j¡ |  |jd jj	d¡ |  |jd j
|¡ d S )Nr   r   r   r!   )r   r   r1   r   r   r   r   r   r   r   r   r   r   r   r   Útest_insert_callablev   s    
z#TestActionItem.test_insert_callablec                 C   sL   t | jƒ}ttdd�d�}| d|¡ |  |j|| jg¡ |  |j|¡ d S )Nr%   r&   r   r   r0   r'   r   r   r   Útest_insert_at_start€   s
    
z#TestActionItem.test_insert_at_startc                 C   s6   t | jƒ}| | j¡ |  |jg ¡ |  | jj¡ d S r   )r   r   Úremover   r   ÚassertIsNoner   r   r   r   r   Útest_removeˆ   s    
zTestActionItem.test_removec                 C   s@   t ƒ }|  t¡� | | j¡ W d   ƒ n1 s20    Y  d S r   )r   ÚassertRaisesÚ
ValueErrorr6   r   r   r   r   r   Útest_remove_missing�   s    z"TestActionItem.test_remove_missingc                 C   sN   t | jƒ}ttdd�d�}| | j|¡ |  |j|| jg¡ |  |j|¡ d S r$   )r   r   r   r   Zinsert_beforer   r   r   r'   r   r   r   Útest_insert_before”   s
    
z!TestActionItem.test_insert_beforec                 C   sN   t | jƒ}ttdd�d�}| | j|¡ |  |j| j|g¡ |  |j|¡ d S r$   )r   r   r   r   Zinsert_afterr   r   r   r'   r   r   r   Útest_insert_afterœ   s
    
z TestActionItem.test_insert_afterc                 C   s&   t | jƒ}| d¡}|  || j¡ d S )Nr   )r   r   Úfindr   ©r   r   Úitemr   r   r   Ú	test_find¤   s    

zTestActionItem.test_findc                 C   s"   t | jƒ}| d¡}|  |¡ d S )NzNot here)r   r   r>   r7   r?   r   r   r   Útest_find_missing©   s    

z TestActionItem.test_find_missingc                 C   sR   t | jƒ}d|_|  | jj¡ |  | jj¡ d|_|  | jj¡ |  | jj¡ d S )NFT)r   r   ZenabledZassertFalser   Ú
assertTruer   r   r   r   Útest_enabled_changed®   s    
z#TestActionItem.test_enabled_changedN)Ú__name__Ú
__module__Ú__qualname__r   r   r    r"   r#   r(   r*   r+   r-   r/   r2   r3   r4   r5   r8   r;   r<   r=   rA   rB   rD   r   r   r   r   r      s*   



r   )ZunittestZtraits.testing.apir   r   r   r   r   r   r   ZTestCaser   r   r   r   r   Ú<module>   s
   