o
    (]^q  ã                   @   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deeee f dee fdd„ZdS )é    )ÚSized)ÚUnion)ÚBaseMatcher)ÚDescription)Ú	hasmethod)Úwrap_matcher)ÚMatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtc                       sd   e Zd Zdee ddfdd„Zdedefdd„Zded	e	ddf‡ fd
d„Z
de	ddfdd„Z‡  ZS )Ú	HasLengthÚlen_matcherÚreturnNc                 C   s
   || _ d S )N)r
   )Úselfr
   © r   úC/usr/lib/python3/dist-packages/hamcrest/library/object/haslength.pyÚ__init__   s   
zHasLength.__init__Úitemc                 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Úmismatch_descriptionc                    s8   t t| ƒ ||¡ t|dƒr| d¡ t|ƒ¡ d S 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Údescriptionc                 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   Úhamcrest.core.base_matcherr   Úhamcrest.core.descriptionr   Úhamcrest.core.helpers.hasmethodr   Ú"hamcrest.core.helpers.wrap_matcherr   Úhamcrest.core.matcherr   Ú
__author__Ú__copyright__Ú__license__r	   r!   r%   r   r   r   r   Ú<module>   s    &