U
    Mf	                     @   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eeee f eeee f eeeef  d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                   @   sN   e Zd Zee ee ddddZeeef edddZ	e
ddd	d
ZdS )IsDictContainingN)key_matchervalue_matcherreturnc                 C   s   || _ || _d S )N)r   r   )selfr   r    r   Q/tmp/pip-unpacked-wheel-97nlcpo6/hamcrest/library/collection/isdict_containing.py__init__   s    zIsDictContaining.__init__)itemr   c                 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)descriptionr   c                 C   s*   | d| j d| j d d S )Nza dictionary containing [z: ])Zappend_textZ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   Zhamcrest.core.base_matcherr   Zhamcrest.core.descriptionr   Zhamcrest.core.helpers.hasmethodr   Z"hamcrest.core.helpers.wrap_matcherr	   Zhamcrest.core.matcherr
   
__author____copyright____license__r   r   r   r%   r   r   r   r   <module>   s    