o
    ¯bk  ã                   @   s.   d dl mZ d dlmZ G dd„ dejƒZdS )é    )Úroots)Úunittestc                   @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
Ú
RootsTestsc                 C   s`   t  ¡ }z| d¡ W n	 ty   Y nw |  ¡  z| ¡  W n
 ty)   Y d S w |  ¡  d S )Ns   blah)r   ÚRequestÚwriteÚNotImplementedErrorÚfailÚfinish)ÚselfÚrequest© r   ú9/usr/lib/python3/dist-packages/twisted/test/test_roots.pyÚtestExceptions
   s   ÿÿzRootsTests.testExceptionsc                 C   s    t  ¡ }| dd¡ |  | d¡d¡ | d¡ |  | d¡d ¡ z| dd ¡ W n	 ty2   Y nw |  ¡  z| 	dd ¡ W n
 tyI   Y d S w |  ¡  d S )NÚxÚtest)
r   Ú
CollectionÚ	putEntityÚassertEqualÚgetStaticEntityÚ	delEntityÚstoreEntityr   r   ÚremoveEntity)r
   Ú
collectionr   r   r   ÚtestCollection   s"   
ÿÿzRootsTests.testCollectionc                 C   sB   G dd„ dt jƒ}|ƒ }|  | dd¡¡ |  t j|jdd¡ d S )Nc                   @   s   e Zd Zdd„ ZdS )z)RootsTests.testConstrained.<locals>.constc                 S   s   |dkS )Nr   r   )r
   Únamer   r   r   ÚnameConstraint.   s   z8RootsTests.testConstrained.<locals>.const.nameConstraintN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   Úconst-   s    r   r   r   Úy)r   ÚConstrainedÚassertIsNoner   ÚassertRaisesÚConstraintViolation)r
   r   Úcr   r   r   ÚtestConstrained,   s   zRootsTests.testConstrainedc                 C   sD   t  ¡ }t|_| dd¡ |  | d¡d¡ |  t j|jdd¡ d S )NÚaé   r   r    )	r   Ú
HomogenousÚintÚ
entityTyper   r   r   r#   r$   )r
   Úhr   r   r   ÚtestHomogenous5   s
   zRootsTests.testHomogenousN)r   r   r   r   r   r&   r-   r   r   r   r   r   	   s
    	r   N)Útwisted.pythonr   Útwisted.trialr   ÚTestCaser   r   r   r   r   Ú<module>   s   