File: //usr/lib/python3/dist-packages/hamcrest/library/object/__pycache__/haslength.cpython-38.pyc
U
�b�V� � @ sL d dl mZ d dlmZ d dlmZ dZdZdZG dd� de�Z d d
� Z
dS )� )�BaseMatcher)� hasmethod)�wrap_matcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtc s4 e Zd Zdd� Zdd� Z� fdd�Zdd� Z� ZS ) � HasLengthc C s
|| _ d S )N)�len_matcher)�selfr � r �C/usr/lib/python3/dist-packages/hamcrest/library/object/haslength.py�__init__ s zHasLength.__init__c C s t |d�sdS | j�t|��S )N�__len__F)r r Zmatches�len)r �itemr r r �_matches s
zHasLength._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
Zmismatch_description�� __class__r r r s
�zHasLength.describe_mismatchc C s |� d��| j� d S )Nzan object with length of )r r r )r Zdescriptionr r r �describe_to s
�zHasLength.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)Zhamcrest.core.base_matcherr Zhamcrest.core.helpers.hasmethodr Z"hamcrest.core.helpers.wrap_matcherr �
__author__Z
__copyright__Z__license__r r r r r r �<module> s