3
de	                 @   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   </tmp/pip-build-7vycvbft/traits/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|j | jt d |_W d Q R X | j|j t tddd}| j|j | jt d |_W d Q R X | j|j d S )N      )r   )r   )r   r   assertIsNotNoner   Z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|j d |_| j|j t tddd}| j|j d |_| j|j d S )Nr   r   )r   )r   )r   r   r   r   assertIsNoner   )r   r   r   r   r   test_explicitly_allow_none5   s    z'TestInstance.test_explicitly_allow_nonec             C   s`   t tddd}| j|j d |_| j|j t tddd}| j|j d |_| j|j d S )Nr   r   )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
   