
    eq                         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ee         Zdeeee   f   dee   fdZy)    )Sized)Union)BaseMatcher)Description)	hasmethod)wrap_matcher)MatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtc                   b     e Zd Zdee   ddfdZdedefdZdede	ddf fdZ
d	e	ddfd
Z xZS )	HasLengthlen_matcherreturnNc                     || _         y )N)r   )selfr   s     C/usr/lib/python3/dist-packages/hamcrest/library/object/haslength.py__init__zHasLength.__init__   s
    &    itemc                 d    t        |d      sy| j                  j                  t        |            S )N__len__F)r   r   matcheslen)r   r   s     r   _matcheszHasLength._matches   s*    y)''D	22r   mismatch_descriptionc                     t         t        |   ||       t        |d      r*|j	                  d      j                  t        |             y y )Nr   z with length of )superr   describe_mismatchr   append_textappend_description_ofr   )r   r   r   	__class__s      r   r   zHasLength.describe_mismatch   sE    i07KLT9% ,,-?@VVWZ[_W`a &r   descriptionc                 X    |j                  d      j                  | j                         y )Nzan object with length of )r   r   r   )r   r    s     r   describe_tozHasLength.describe_to   s#     ;<RRSWScScdr   )__name__
__module____qualname__r	   intr   r   boolr   r   r   r"   __classcell__)r   s   @r   r   r      sb    'GCL 'T '3U 3t 3
be b; bSW b
e{ et er   r   matchr   c                 *    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)   s    r   
has_lengthr+   !   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   <module>r7      sa    !  2 1 5 ; )
-$eE" e$*eC-. *75> *r   