/usr/lib/python3/dist-packages/hamcrest/library/object/__pycache__
Edit: /usr/lib/python3/dist-packages/hamcrest/library/object/__pycache__/haslength.cpython-310.pyc (2556B)
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 Ú
s &