PHP WebShell

Текущая директория: /usr/lib/python3/dist-packages/hamcrest/library/collection/__pycache__

Просмотр файла: isdict_containingentries.cpython-310.pyc

o

(]^<�@s"ddlmZmZmZmZmZmZmZddlm	Z	ddl
mZddlm
Z
ddlmZdZdZdZed	ed
�Zed�ZGdd
�d
e	eeef�Zedeeeefdeeeeffdd��Zedeeeeeeffdeeeeffdd��Zededeeeeffdd��Zdd�ZdS)�)�Any�Hashable�Mapping�Optional�TypeVar�Union�overload)�BaseMatcher)�Description)�wrap_matcher)�MatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txt�K)�bound�Vc@s�eZdZddd�Zdeeefdeede	fdd�Z
	ddeeefdeede	fd	d
�Zdeeefdeddfdd�Zd
e
dededdfdd�Zdeddfdd�ZdS)�IsDictContainingEntries�returnNcCst|���|_dS�N)�sorted�items�value_matchers)�selfr�r�V/usr/lib/python3/dist-packages/hamcrest/library/collection/isdict_containingentries.py�__init__sz IsDictContainingEntries.__init__�item�mismatch_descriptioncCs|r
|�|��d�dS)Nz is not a mapping objectF��append_description_of�append_text�rrrrrr�_not_a_dictionarysz)IsDictContainingEntries._not_a_dictionaryc	Cs�|jD]c\}}z||vr |r|�d��|��d��|�WdSWnty2|�||�YSwz||}WntyJ|�||�YSw|�|�sf|rc|�d��|��d�|�||�dSqdS)Nzno z key in Fz
value for � T)rrr�	TypeErrorr �matches�describe_mismatch)rrr�key�
value_matcher�actual_valuerrrr#s8
����

��zIsDictContainingEntries.matchescCs|�||�dSr)r#rrrrr$9sz)IsDictContainingEntries.describe_mismatch�index�value�descriptioncCs|�|��d��|�dS)z(Describes key-value pair at given index.z: Nr)rr(r)r*rrr�describe_keyvalue<sz)IsDictContainingEntries.describe_keyvaluecCsL|�d�d}|jD]\}}|s|�d�|�|||�d}q
|�d�dS)Nza dictionary containing {Tz, F�})rrr+)rr*�firstr%r)rrr�describe_to@s

z#IsDictContainingEntries.describe_to)rNr)�__name__�
__module__�__qualname__rrr
rrr
�boolr r#r$�intr+r.rrrrrs(

��
��
��
�r�keys_valuematchersrcK�dSrr�r4rrr�has_entriesL�r7cCr5rrr6rrrr7Rr8cGr5rrr6rrrr7Xr8cOs�t|�dkr'z|d��}|D]
}t||�||<qWn4ty&td��wt|�dr1td��i}ttt|�d��D]}t|d|d�||d|<q=|��D]
\}}t|�||<qTt|�S)a%Matches if dictionary contains entries satisfying a dictionary of keys
    and corresponding value matchers.

    :param matcher_dict: A dictionary mapping keys to associated value matchers,
        or to expected values for
        :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    Note that the keys must be actual keys, not matchers. Any value argument
    that is not a matcher is implicitly wrapped in an
    :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for
    equality.

    Examples::

        has_entries({'foo':equal_to(1), 'bar':equal_to(2)})
        has_entries({'foo':1, 'bar':2})

    ``has_entries`` also accepts a list of keyword arguments:

    .. function:: has_entries(keyword1=value_matcher1[, keyword2=value_matcher2[, ...]])

    :param keyword1: A keyword to look up.
    :param valueMatcher1: The matcher to satisfy for the value, or an expected
        value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    Examples::

        has_entries(foo=equal_to(1), bar=equal_to(2))
        has_entries(foo=1, bar=2)

    Finally, ``has_entries`` also accepts a list of alternating keys and their
    value matchers:

    .. function:: has_entries(key1, value_matcher1[, ...])

    :param key1: A key (not a matcher) to look up.
    :param valueMatcher1: The matcher to satisfy for the value, or an expected
        value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    Examples::

        has_entries('foo', equal_to(1), 'bar', equal_to(2))
        has_entries('foo', 1, 'bar', 2)

    �rzEsingle-argument calls to has_entries must pass a dict as the argument�z$has_entries requires key-value pairs)	�len�copyr�AttributeError�
ValueError�ranger3rr)r4�kv_args�	base_dictr%r(r)rrrr7]s*.����N)�typingrrrrrrr�hamcrest.core.base_matcherr	�hamcrest.core.descriptionr
�"hamcrest.core.helpers.wrap_matcherr�hamcrest.core.matcherr�
__author__�
__copyright__�__license__r
rr�strr7rrrr�<module>s$$<,4 

Выполнить команду


Для локальной разработки. Не используйте в интернете!