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 )ÚIsDictContainingValuec                 C   s
   || _ d S )N)Úvalue_matcher)Úselfr   © r   úT/usr/lib/python3/dist-packages/hamcrest/library/collection/isdict_containingvalue.pyÚ__init__   s    zIsDictContainingValue.__init__c                 C   s.   t |dƒr*| ¡ D ]}| j |¡r dS qdS )NÚvaluesTF)r   r   r   Zmatches)r   Z
dictionaryÚvaluer   r   r	   Ú_matches   s
    
zIsDictContainingValue._matchesc                 C   s   |  d¡ | j¡ d S )Nza dictionary containing value )Zappend_textZappend_description_ofr   )r   Zdescriptionr   r   r	   Údescribe_to   s    
ÿz!IsDictContainingValue.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 value satisfies a given
    matcher.

    :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 whose value satisfies the given matcher. If a matching entry is
    found, ``has_value`` 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_value(equal_to('bar'))
        has_value('bar')

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