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 )ÚIsDictContainingKeyc                 C   s
   || _ d S )N)Úkey_matcher)Úselfr   © r   úR/usr/lib/python3/dist-packages/hamcrest/library/collection/isdict_containingkey.pyÚ__init__   s    zIsDictContainingKey.__init__c                 C   s.   t |dƒr*| ¡ D ]}| j |¡r dS qdS )NÚkeysTF)r   r   r   Zmatches)r   Z
dictionaryÚkeyr   r   r	   Ú_matches   s
    
zIsDictContainingKey._matchesc                 C   s   |  d¡ | j¡ d S )Nza dictionary containing key )Zappend_textZappend_description_ofr   )r   Zdescriptionr   r   r	   Údescribe_to   s    
ÿzIsDictContainingKey.describe_toN)Ú__name__Ú
__module__Ú__qualname__r
   r   r   r   r   r   r	   r   
   s   r   c                 C   s   t t| ƒƒS )aŽ  Matches if dictionary contains an entry whose key satisfies a given
    matcher.

    :param key_match: The matcher to satisfy for the key, 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 whose key satisfies the given matcher. If a matching entry is found,
    ``has_key`` 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_key(equal_to('foo'))
        has_key('foo')

    )r   r   )Z	key_matchr   r   r	   Úhas_key   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   