U
    ôbÛV  ã                   @   sL   d dl mZ d dlmZ d dlmZ dZdZdZG dd„ deƒZ	d	d
„ Z
dS )é    )ÚBaseMatcher)Ú	hasmethod)Úwrap_matcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtc                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚIsDictContainingc                 C   s   || _ || _d S )N)Úkey_matcherÚvalue_matcher)Úselfr   r   © r	   úO/usr/lib/python3/dist-packages/hamcrest/library/collection/isdict_containing.pyÚ__init__   s    zIsDictContaining.__init__c                 C   s>   t |dƒr:| ¡ D ]&\}}| j |¡r| j |¡r dS qdS )NÚitemsTF)r   r   r   Zmatchesr   )r   Z
dictionaryÚkeyÚvaluer	   r	   r
   Ú_matches   s
    
zIsDictContaining._matchesc                 C   s*   |  d¡ | j¡  d¡ | j¡  d¡ d S )Nza dictionary containing [z: ú])Zappend_textZappend_description_ofr   r   )r   Zdescriptionr	   r	   r
   Údescribe_to   s    
ÿþýüzIsDictContaining.describe_toN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r	   r	   r	   r
   r   
   s   r   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   )Z	key_matchZvalue_matchr	   r	   r
   Ú	has_entry   s    r   N)Zhamcrest.core.base_matcherr   Zhamcrest.core.helpers.hasmethodr   Z"hamcrest.core.helpers.wrap_matcherr   Ú
__author__Z__copyright__Z__license__r   r   r	   r	   r	   r
   Ú<module>   s   