3
7฿L]ก  ใ               @   s\   d dl mZ 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 )
้    )ฺabsolute_importN)ฺ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 jd d S )Nฺcalled)ฺmemoฺappendฉ )ฺselfr   ๚B/tmp/pip-install-5sebvq2j/pyface/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| jg | j| 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}| jt|jd | j|jd j| j | j|jd j| d S )N้   r   )r   r   r   ฺlenr   r   )r   r   r   r   r   ฺtest_init_action    s    
zTestActionItem.test_init_actionc             C   sb   t | j}| jt|jd | j|jd jj| j | j|jd jjd | j|jd j| d S )Nr   r   ฺPerform)	r   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|jg  d S )N)r   r   r   )r   r   r   r   r   ฺtest_init_nothing-   s    z TestActionItem.test_init_nothingc             C   sJ   t | j}ttddd}|j| | j|j| j|g | j|j| d S )NzAction 2)r   )r   )r   r   r   r   r   r   r   r   )r   r   ฺaction_item2r   r   r   ฺtest_append1   s
    

zTestActionItem.test_appendc             C   sp   t | j}tdd}|j| | jt|jd | j|jd | j | j|jd j| | j|jd j| d S )NzAction 2)r   r   r   r   )	r   r   r   r   r   r   r   r   r   )r   r   ฺaction2r   r   r   ฺtest_append_action9   s    


z!TestActionItem.test_append_actionc             C   s   t | j}tdd}|j| j | jt|jd | j|jd | j | j|jd jj	| j | j|jd jj
d | j|jd j| d S )NzAction 2)r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r#   r   r   r   ฺtest_append_callableC   s    

z#TestActionItem.test_append_callablec             C   s$   t | j}|j  | j|jg  d S )N)r   r   ฺclearr   r   )r   r   r   r   r   ฺ
test_clearN   s    
zTestActionItem.test_clearc             C   s(   t | j}|j  | j|j| jg d S )N)r   r   ฺdestroyr   r   )r   r   r   r   r   ฺtest_destroyV   s    
zTestActionItem.test_destroyc             C   sL   t | j}ttddd}|jd| | j|j| j|g | j|j| d S )NzAction 2)r   )r   r   )r   r   r   r   ฺinsertr   r   r   )r   r   r!   r   r   r   ฺtest_insert]   s
    
zTestActionItem.test_insertc             C   sr   t | j}tdd}|jd| | jt|jd | j|jd | j | j|jd j| | j|jd j| d S )NzAction 2)r   r   r   r   )	r   r   r   r*   r   r   r   r   r   )r   r   r#   r   r   r   ฺtest_insert_actione   s    

z!TestActionItem.test_insert_actionc             C   s   t | j}tdd}|jd| j | jt|jd | j|jd | j | j|jd jj	| j | j|jd jj
d | j|jd j| d S )NzAction 2)r   r   r   r   r   )r   r   r   r*   r   r   r   r   r   r   r   r   )r   r   r#   r   r   r   ฺtest_insert_callableo   s    

z#TestActionItem.test_insert_callablec             C   sL   t | j}ttddd}|jd| | j|j|| jg | j|j| d S )NzAction 2)r   )r   r   )r   r   r   r   r*   r   r   r   )r   r   r!   r   r   r   ฺtest_insert_at_startz   s
    
z#TestActionItem.test_insert_at_startc             C   s6   t | j}|j| j | j|jg  | j| jj d S )N)r   r   ฺremover   r   ฺassertIsNoner   )r   r   r   r   r   ฺtest_remove   s    
zTestActionItem.test_removec          	   C   s,   t  }| jt |j| j W d Q R X d S )N)r   ZassertRaisesฺ
ValueErrorr/   r   )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|j|| jg | j|j| d S )NzAction 2)r   )r   )r   r   r   r   Zinsert_beforer   r   r   )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|j| j|g | j|j| d S )NzAction 2)r   )r   )r   r   r   r   Zinsert_afterr   r   r   )r   r   r!   r   r   r   ฺtest_insert_after   s
    
z TestActionItem.test_insert_afterc             C   s&   t | j}|jd}| j|| j d S )Nr   )r   r   ฺfindr   )r   r   ฺitemr   r   r   ฺ	test_find   s    

zTestActionItem.test_findc             C   s"   t | j}|jd}| j| d S )NzNot here)r   r   r6   r0   )r   r   r7   r   r   r   ฺtest_find_missingฃ   s    

z TestActionItem.test_find_missingc             C   sR   t | j}d|_| j| jj | j| jj d|_| j| jj | j| jj d S )NFT)r   r   ZenabledZassertFalser   Z
assertTrue)r   r   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)   r+   r,   r-   r.   r1   r3   r4   r5   r8   r9   r:   r   r   r   r   r      s*   

r   )ฺ
__future__r   ZunittestZtraits.testing.unittest_toolsr   r   r   r   r   r   r   ZTestCaser   r   r   r   r   ฺ<module>   s   