o
    (]^	  ã                	   @   sÎ   d dl mZmZmZ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ed
ed�ZedƒZG dd„ deeeef  ƒZdeeee f deeee f deeeef  fdd„ZdS )é    )ÚHashableÚMappingÚTypeVarÚUnion)ÚBaseMatcher)ÚDescription)Ú	hasmethod)Úwrap_matcher)ÚMatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtÚK)ÚboundÚVc                   @   sV   e Zd Zdee dee ddfdd„Zdeeef defdd	„Z	d
e
ddfdd„ZdS )ÚIsDictContainingÚkey_matcherÚvalue_matcherÚreturnNc                 C   s   || _ || _d S )N)r   r   )Úselfr   r   © r   úO/usr/lib/python3/dist-packages/hamcrest/library/collection/isdict_containing.pyÚ__init__   s   
zIsDictContaining.__init__Úitemc                 C   s>   t |dƒr| ¡ D ]\}}| j |¡r| j |¡r dS q	dS )NÚitemsTF)r   r   r   Úmatchesr   )r   r   ÚkeyÚvaluer   r   r   Ú_matches   s   
€zIsDictContaining._matchesÚdescriptionc                 C   s*   |  d¡ | j¡  d¡ | j¡  d¡ d S )Nza dictionary containing [z: ú])Úappend_textÚappend_description_ofr   r   )r   r   r   r   r   Údescribe_to   s   
ÿzIsDictContaining.describe_to)Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   r   Úboolr   r   r    r   r   r   r   r      s    r   Ú	key_matchÚvalue_matchr   c                 C   s   t t| ƒt|ƒƒS )aO  Matches if dictionary contains key-value entry satisfying a given pair
    of matchers.

    :param key_match: The matcher to satisfy for the key, or an expected value
        for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.
    :param value_match: The matcher to satisfy for the value, or an expected
        value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching.

    This matcher iterates the evaluated dictionary, searching for any key-value
    entry that satisfies ``key_match`` and ``value_match``. If a matching entry
    is found, ``has_entry`` is satisfied.

    Any 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_entry(equal_to('foo'), equal_to(1))
        has_entry('foo', 1)

    )r   r	   )r%   r&   r   r   r   Ú	has_entry$   s   r'   N)Útypingr   r   r   r   Ú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   r   Ú<module>   s&    ÿÿþ