3
8฿L]ข  ใ               @   s   d Z ddlZddlmZ ddlmZmZ g ZG dd deZG dd deZ	G d	d
 d
eZ
G dd deZG dd deZG dd dejZdS )z! Tests for the static notifiers. ้    N)ฺtrait_notifiers)ฺFloatฺ	HasTraitsc               @   s$   e Zd ZeZdd ZeZdd ZdS )ฺStaticNotifiers0c               C   s   t jd d S )NT)ฺcalls_0ฺappendฉ r   r   ๚F/tmp/pip-install-5sebvq2j/traits/traits/tests/test_static_notifiers.pyฺ_ok_changed   s    zStaticNotifiers0._ok_changedc               C   s   t dd S )Nฺerror)ฺ	Exceptionr   r   r   r	   ฺ_fail_changed   s    zStaticNotifiers0._fail_changedN)ฺ__name__ฺ
__module__ฺ__qualname__r   ฺokr
   ฺfailr   r   r   r   r	   r      s   r   c               @   s$   e Zd ZeZdd ZeZdd ZdS )ฺStaticNotifiers1c             C   s    t | dsg | _| jjd d S )NฺcallsT)ฺhasattrr   r   )ฺselfr   r   r	   r
      s    
zStaticNotifiers1._ok_changedc             C   s   t dd S )Nr   )r   )r   r   r   r	   r   %   s    zStaticNotifiers1._fail_changedN)r   r   r   r   r   r
   r   r   r   r   r   r	   r      s   r   c               @   s$   e Zd ZeZdd ZeZdd ZdS )ฺStaticNotifiers2c             C   s    t | dsg | _| jj| d S )Nr   )r   r   r   )r   ฺnewr   r   r	   r
   ,   s    
zStaticNotifiers2._ok_changedc             C   s   t dd S )Nr   )r   )r   r   r   r   r	   r   3   s    zStaticNotifiers2._fail_changedN)r   r   r   r   r   r
   r   r   r   r   r   r	   r   )   s   r   c               @   s$   e Zd ZeZdd ZeZdd ZdS )ฺStaticNotifiers3c             C   s$   t | dsg | _| jj||f d S )Nr   )r   r   r   )r   ฺoldr   r   r   r	   r
   :   s    
zStaticNotifiers3._ok_changedc             C   s   t dd S )Nr   )r   )r   r   r   r   r   r	   r   A   s    zStaticNotifiers3._fail_changedN)r   r   r   r   r   r
   r   r   r   r   r   r	   r   7   s   r   c               @   s$   e Zd ZeZdd ZeZdd ZdS )ฺStaticNotifiers4c             C   s&   t | dsg | _| jj|||f d S )Nr   )r   r   r   )r   ฺnamer   r   r   r   r	   r
   H   s    
zStaticNotifiers4._ok_changedc             C   s   t dd S )Nr   )r   )r   r   r   r   r   r   r	   r   O   s    zStaticNotifiers4._fail_changedN)r   r   r   r   r   r
   r   r   r   r   r   r	   r   E   s   r   c               @   sP   e Zd 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S )ฺTestNotifierszJ Tests for the static notifiers, and the "anytrait" static notifiers.
    c             C   s   g | _ tj| j d S )N)ฺ
exceptionsr   Zpush_exception_handlerฺ_handle_exception)r   r   r   r	   ฺsetUpW   s    zTestNotifiers.setUpc             C   s   t j  d S )N)r   Zpop_exception_handler)r   r   r   r	   ฺtearDown[   s    zTestNotifiers.tearDownc             C   s   | j j||||f d S )N)r   r   )r   ฺobjr   r   r   r   r   r	   r   ^   s    zTestNotifiers._handle_exceptionc             C   sB   t dd}d|_| jttd d|_| j| j|dddfg d S )N้   )r   ้   ้   r   r   )r   r   ฺassertEqualฺlenr   r   r   )r   r"   r   r   r	   ฺtest_static_notifiers_0a   s
    
z%TestNotifiers.test_static_notifiers_0c             C   sD   t dd}d|_| jt|jd d|_| j| j|dddfg d S )Nr#   )r   r$   r%   r   r   )r   r   r&   r'   r   r   r   )r   r"   r   r   r	   ฺtest_static_notifiers_1i   s
    
z%TestNotifiers.test_static_notifiers_1c             C   sD   t dd}d|_| j|jddg d|_| j| j|dddfg d S )Nr#   )r   r$   r%   r   r   )r   r   r&   r   r   r   )r   r"   r   r   r	   ฺtest_static_notifiers_2q   s
    
z%TestNotifiers.test_static_notifiers_2c             C   sD   t dd}d|_| j|jddg d|_| j| j|dddfg d S )	Nr#   )r   r$   r   r%   r   )r   r#   )r#   r$   )r   r   r&   r   r   r   )r   r"   r   r   r	   ฺtest_static_notifiers_3x   s
    
z%TestNotifiers.test_static_notifiers_3c             C   sD   t dd}d|_| j|jdd	g d|_| j| j|dddfg d S )
Nr#   )r   r$   r   r   r%   r   )r   r   r#   )r   r#   r$   )r   r   r&   r   r   r   )r   r"   r   r   r	   ฺtest_static_notifiers_4   s
    
z%TestNotifiers.test_static_notifiers_4N)r   r   r   ฺ__doc__r    r!   r   r(   r)   r*   r+   r,   r   r   r   r	   r   S   s   r   )r-   ZunittestZtraitsr   Z
traits.apir   r   r   r   r   r   r   r   ZTestCaser   r   r   r   r	   ฺ<module>   s   