U
    ôbÛV‘  ã                   @   sL   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ƒZ	d	d
„ Z
dS )é    )ÚBaseMatcher)Ú	hasmethod)Úwrap_matcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtc                       s4   e Zd Zdd„ Zdd„ Z‡ fdd„Zdd„ Z‡  ZS )	Ú	HasLengthc                 C   s
   || _ d S )N)Úlen_matcher)Úselfr   © r   úC/usr/lib/python3/dist-packages/hamcrest/library/object/haslength.pyÚ__init__   s    zHasLength.__init__c                 C   s   t |dƒsdS | j t|ƒ¡S )NÚ__len__F)r   r   ZmatchesÚlen)r   Úitemr   r   r	   Ú_matches   s    
zHasLength._matchesc                    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   Zmismatch_description©Ú	__class__r   r	   r      s
    

ÿzHasLength.describe_mismatchc                 C   s   |  d¡ | j¡ d S )Nzan object with length of )r   r   r   )r   Zdescriptionr   r   r	   Údescribe_to   s    
ÿzHasLength.describe_to)Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   Ú__classcell__r   r   r   r	   r   
   s   r   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   )Úmatchr   r   r	   Ú
has_length   s    r   N)Zhamcrest.core.base_matcherr   Zhamcrest.core.helpers.hasmethodr   Z"hamcrest.core.helpers.wrap_matcherr   Ú
__author__Z__copyright__Z__license__r   r   r   r   r   r	   Ú<module>   s   