File: //usr/lib/python3/dist-packages/hamcrest/library/object/__pycache__/haslength.cpython-310.pyc
o
(]^q � @ s� d dl mZ d dlmZ d dlmZ d dlmZ d dlm Z d dl
mZ d dlm
Z
dZd Zd
ZG dd� dee �Zd
eee
e f de
e fdd�ZdS )� )�Sized)�Union)�BaseMatcher)�Description)� hasmethod)�wrap_matcher)�MatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtc sd e Zd Zdee ddfdd�Zdedefdd�Zded e ddf� fd
d�Z
de ddfd
d�Z� ZS )� 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
zHasLength.__init__�itemc C s t |d�sdS | j�t|��S )N�__len__F)r r
�matches�len)r r r
r
r �_matches s
zHasLength._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
�zHasLength.describe_mismatch�descriptionc C s |� d��| j� d S )Nzan object with length of )r r r
)r r r
r
r �describe_to s zHasLength.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 &