a
    ¦ce	  ć                   @   sR   d Z ddlZddlmZmZmZmZ eeZG dd deZ	G dd dej
ZdS )z6
Tests for the Instance and BaseInstance trait types.
é    N)ŚBaseInstanceŚHasStrictTraitsŚInstanceŚ
TraitErrorc                   @   sF   e Zd ZeeZe ZeeddZeddZ	eeddZ
eddZdS )Ś	HasSlicesT)Ś
allow_noneFN)Ś__name__Ś
__module__Ś__qualname__r   ŚsliceŚmy_sliceŚSliceŚalso_my_sliceŚnone_explicitly_allowedŚalso_allow_noneŚdisallow_noneŚalso_disallow_none© r   r   ś]/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traits/tests/test_instance.pyr      s   
r   c                   @   s$   e Zd Zdd Zdd Zdd ZdS )ŚTestInstancec                 C   s“   t tddd}|  |j” |  t” d |_W d    n1 sB0    Y  |  |j” t tddd}|  |j” |  t” d |_W d    n1 s0    Y  |  |j” d S )Né   é   )r   )r   )r   r   ŚassertIsNotNoner   ŚassertRaisesr   r   ©ŚselfŚobjr   r   r   Śtest_explicitly_prohibit_none(   s    $$z*TestInstance.test_explicitly_prohibit_nonec                 C   s`   t tddd}|  |j” d |_|  |j” t tddd}|  |j” d |_|  |j” d S )Nr   r   )r   )r   )r   r   r   r   ŚassertIsNoner   r   r   r   r   Śtest_explicitly_allow_none5   s    z'TestInstance.test_explicitly_allow_nonec                 C   s`   t tddd}|  |j” d |_|  |j” t tddd}|  |j” d |_|  |j” d S )Nr   r   )r   )r   )r   r   r   r   r   r   r   r   r   r   Ś$test_allow_none_permitted_by_default@   s    z1TestInstance.test_allow_none_permitted_by_defaultN)r   r	   r
   r   r   r    r   r   r   r   r   '   s   r   )Ś__doc__ZunittestZ
traits.apir   r   r   r   r   r   r   ZTestCaser   r   r   r   r   Ś<module>   s
   