B
    u9añ  ã               @   sh   d dl mZ d dlZG dd„ dƒZG dd„ deƒZG dd„ deƒZG d	d
„ d
ejƒZedkrde 	¡  dS )é    )ÚdequeNc               @   s   e Zd Zdd„ ZdS )Úbase_setc             C   s
   || _ d S )N)Úel)Úselfr   © r   ú#/usr/lib/python3.7/test_contains.pyÚ__init__   s    zbase_set.__init__N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r      s   r   c               @   s   e Zd Zdd„ ZdS )Úmysetc             C   s
   | j |kS )N)r   )r   r   r   r   r   Ú__contains__
   s    zmyset.__contains__N)r	   r
   r   r   r   r   r   r   r   	   s   r   c               @   s   e Zd Zdd„ ZdS )Úseqc             C   s   | j g| S )N)r   )r   Únr   r   r   Ú__getitem__   s    zseq.__getitem__N)r	   r
   r   r   r   r   r   r   r      s   r   c               @   s,   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	S )
ÚTestContainsc                s´   t dƒ‰ tdƒ}tdƒ}|  d|¡ |  d|¡ |  d|¡ |  d|¡ |  t‡ fdd„¡ |  t‡ fdd„¡ |  dd¡ |  dd¡ |  d	d	¡ |  d	d¡ |  td
d„ ¡ d S )Né   r   c                  s   dˆ kS )Nr   r   r   )Úar   r   Ú<lambda>   ó    z0TestContains.test_common_tests.<locals>.<lambda>c                  s   dˆ kS )Nr   r   r   )r   r   r   r      r   ÚcÚabcÚdÚ c               S   s   d dkS )Nr   r   r   r   r   r   r   $   r   )r   r   r   ÚassertInÚassertNotInÚassertRaisesÚ	TypeError)r   Úbr   r   )r   r   Útest_common_tests   s    zTestContains.test_common_testsc             C   s–   t dƒ}x|D ]}|  ||¡ qW |  d|¡ |  ||¡ t|ƒ}x|D ]}|  ||¡ qHW |  d|¡ |  ||¡ G dd„ dƒ}|  |ƒ |j¡ d S )Né
   é   c               @   s    e Zd ZeedƒƒZdd„ ZdS )z:TestContains.test_builtin_sequence_types.<locals>.Deviant1é   c             S   s0   |dkr,| j  d¡ | j  d¡ | j  d¡ dS )Né   é   é   r   )ÚaListÚremove)r   Úotherr   r   r   Ú__eq__;   s
    zATestContains.test_builtin_sequence_types.<locals>.Deviant1.__eq__N)r	   r
   r   ÚlistÚranger&   r)   r   r   r   r   ÚDeviant14   s   r,   )r+   r   r   Útupler&   )r   r   Úir,   r   r   r   Útest_builtin_sequence_types&   s    

z(TestContains.test_builtin_sequence_typesc             C   sŠ   G dd„ dt ƒ}tdƒdd d|ƒ f}tttjtttf}xN|D ]F}||ƒ}x|D ]}|  	||¡ qNW |  
|||ƒk¡ |  
||k¡ q<W d S )Nc               @   s   e Zd Zdd„ Zdd„ ZdS )z6TestContains.test_nonreflexive.<locals>.MyNonReflexivec             S   s   dS )NFr   )r   r(   r   r   r   r)   I   s    z=TestContains.test_nonreflexive.<locals>.MyNonReflexive.__eq__c             S   s   dS )Né   r   )r   r   r   r   Ú__hash__K   s    z?TestContains.test_nonreflexive.<locals>.MyNonReflexive.__hash__N)r	   r
   r   r)   r1   r   r   r   r   ÚMyNonReflexiveH   s   r2   Únanr   r   )ÚobjectÚfloatr*   r-   ÚdictÚfromkeysÚsetÚ	frozensetr   r   Z
assertTrue)r   r2   ÚvaluesZconstructorsÚconstructorÚ	containerÚelemr   r   r   Útest_nonreflexiveD   s    

zTestContains.test_nonreflexivec                sd   G dd„ dt ƒ}|ƒ }G dd„ d|ƒ}|ƒ ‰ |  d|k¡ |  dtˆ ƒk¡ |  t‡ fdd„¡ d S )Nc               @   s   e Zd Zdd„ ZdS )z4TestContains.test_block_fallback.<locals>.ByContainsc             S   s   dS )NFr   )r   r(   r   r   r   r   Z   s    zATestContains.test_block_fallback.<locals>.ByContains.__contains__N)r	   r
   r   r   r   r   r   r   Ú
ByContainsY   s   r?   c               @   s   e Zd Zdd„ ZdZdS )z7TestContains.test_block_fallback.<locals>.BlockContainsc             s   s   d S )Nr   )r   r   r   r   Ú__iter__h   s    z@TestContains.test_block_fallback.<locals>.BlockContains.__iter__N)r	   r
   r   r@   r   r   r   r   r   ÚBlockContains]   s   rA   r   c                  s   dˆ kS )Nr   r   r   )Úbcr   r   r   o   r   z2TestContains.test_block_fallback.<locals>.<lambda>)r4   ZassertFalser*   r   r   )r   r?   r   rA   r   )rB   r   Útest_block_fallbackW   s    z TestContains.test_block_fallbackN)r	   r
   r   r   r/   r>   rC   r   r   r   r   r      s   r   Ú__main__)
Úcollectionsr   Zunittestr   r   r   ZTestCaser   r	   Úmainr   r   r   r   Ú<module>   s   `