U
    òÀMfq  ã                   @   s˜   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d dlmZ dZd	Zd
ZG dd„ dee ƒZeeee f ee dœdd„ZdS )é    )ÚSized)ÚUnion)ÚBaseMatcher)ÚDescription)Ú	hasmethod)Úwrap_matcher)ÚMatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtc                       sZ   e Zd Zee ddœdd„Zeedœdd„Zee	ddœ‡ fd	d
„Z
e	ddœdd„Z‡  ZS )Ú	HasLengthN)Úlen_matcherÚreturnc                 C   s
   || _ d S )N)r
   )Úselfr
   © r   úE/tmp/pip-unpacked-wheel-97nlcpo6/hamcrest/library/object/haslength.pyÚ__init__   s    zHasLength.__init__)Úitemr   c                 C   s   t |dƒsdS | j t|ƒ¡S )NÚ__len__F)r   r
   ÚmatchesÚlen)r   r   r   r   r   Ú_matches   s    
zHasLength._matches)r   Úmismatch_descriptionr   c                    s4   t t| ƒ ||¡ t|dƒr0| d¡ t|ƒ¡ d S )Nr   z with length of )Úsuperr	   Údescribe_mismatchr   Úappend_textÚappend_description_ofr   )r   r   r   ©Ú	__class__r   r   r      s    
zHasLength.describe_mismatch)Údescriptionr   c                 C   s   |  d¡ | j¡ d S )Nzan object with length of )r   r   r
   )r   r   r   r   r   Údescribe_to   s    zHasLength.describe_to)Ú__name__Ú
__module__Ú__qualname__r   Úintr   r   Úboolr   r   r   r   Ú__classcell__r   r   r   r   r	      s   r	   )Úmatchr   c                 C   s   t t| ƒƒS )aM  Matches if ``len(item)`` satisfies a given matcher.

    :param match: The matcher to satisfy, or an expected value for
        :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    This matcher invokes the :py:func:`len` function on the evaluated object to
    get its length, passing the result to a given matcher for evaluation.

    If the ``match`` argument is not a matcher, it is implicitly wrapped in an
    :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
    :equality.

    Examples::

        has_length(greater_than(6))
        has_length(5)

    )r	   r   )r$   r   r   r   Ú
has_length!   s    r%   N)Úcollections.abcr   Útypingr   Zhamcrest.core.base_matcherr   Zhamcrest.core.descriptionr   Zhamcrest.core.helpers.hasmethodr   Z"hamcrest.core.helpers.wrap_matcherr   Zhamcrest.core.matcherr   Ú
__author__Ú__copyright__Ú__license__r	   r!   r%   r   r   r   r   Ú<module>   s   