
    e$              	           d dl mZ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      Z ed      Z G 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Zy)    )HashableMappingMutableMappingTypeVarUnion)BaseMatcher)Description)	hasmethod)wrap_matcher)MatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtK)boundVc                        e Zd Zdee   dee   ddfdZdeeef   defdZ	de
ddfd	Zdeeef   d
e
ddf fdZdeeef   de
ddf fdZdeeef   fdZ xZS )IsDictContainingkey_matchervalue_matcherreturnNc                      || _         || _        y )N)r   r   )selfr   r   s      O/usr/lib/python3/dist-packages/hamcrest/library/collection/isdict_containing.py__init__zIsDictContaining.__init__   s    &*    itemc                     t        |d      rQ|j                         D ]>  \  }}| j                  j                  |      s"| j                  j                  |      s> y y)NitemsTF)r
   r   r   matchesr   )r   r   keyvalues       r   _matcheszIsDictContaining._matches   sU    T7#"jjl  
U##++C0T5G5G5O5OPU5V  r   descriptionc                     |j                  d      j                  | j                        j                  d      j                  | j                        j                  d       y )Nza dictionary containing [z: ])append_textappend_description_ofr   r   )r   r!   s     r   describe_tozIsDictContaining.describe_to   sJ     ;<RR	

+d
11$2D2DEkkRUFVr   mismatch_descriptionc                 "   | j                  |      }t        |      dk(  r_|j                         \  }}|j                  d      j	                  |      j                  d       | j
                  j                  ||       y t        |   ||       y N   z
value for  )_matching_keyslenpopitemr$   r%   r   describe_mismatchsuper)r   r   r'   key_matchesr   r   	__class__s         r   r/   z"IsDictContaining.describe_mismatch#   s    ))$/{q $,,.JC ,,\:PPQTUaa 008LMG%d,@Ar   match_descriptionc                 "   | j                  |      }t        |      dk(  r_|j                         \  }}|j                  d      j	                  |      j                  d       | j
                  j                  ||       y t        | !  ||       y r)   )	r,   r-   r.   r$   r%   r   r/   r0   describe_match)r   r   r3   r1   r   r   r2   s         r   r5   zIsDictContaining.describe_match.   s~    ))$/{q $,,.JC)),7MMcR^^_bc008IJG"4):;r   c                     i }t        |d      r9|j                         D ]&  \  }}| j                  j                  |      s"|||<   ( |S )Nr   )r
   r   r   r   )r   r   r1   r   r   s        r   r,   zIsDictContaining._matching_keys7   sP    ,.T7#"jjl -
U##++C0',K$- r   )__name__
__module____qualname__r   r   r   r   r   boolr    r	   r&   r/   r5   r   r,   __classcell__)r2   s   @r   r   r      s    +GAJ +wqz +d +WQT] t W{ Wt W
	Bgadm 	B; 	B[_ 	B<71a4= <[ <UY <nQT&: r   r   	key_matchvalue_matchr   c                 >    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=   s     r   	has_entryr?   @   s    2 L3\+5NOOr   N)typingr   r   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   <module>rJ      s    D D 2 1 5 ; )
-$ Cx CL+{71a4=1 +\PQ
]#P2771:2FPWQT]Pr   