U
    òÀMfÑ  ã                   @   s€   d dl Z d dlmZmZ 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e ƒZeeee f e	e dœdd„ZdS )é    N)ÚPatternÚUnion)ÚBaseMatcher)ÚDescription)ÚMatcherz
Chris RosezCopyright 2011 hamcrest.orgzBSD, see License.txtc                   @   s:   e Zd Zddœdd„Zeddœdd„Zeedœd	d
„ZdS )ÚStringMatchesPatternN)Úreturnc                 C   s
   || _ d S ©N©Úpattern)Úselfr   © r   úG/tmp/pip-unpacked-wheel-97nlcpo6/hamcrest/library/text/stringmatches.pyÚ__init__   s    zStringMatchesPattern.__init__)Údescriptionr   c                 C   s   |  d¡  | jj¡  d¡ d S )Nza string matching 'ú')Zappend_textr   )r   r   r   r   r   Údescribe_to   s
    
ÿþz StringMatchesPattern.describe_to)Úitemr   c                 C   s   | j  |¡d k	S r	   )r   Úsearch)r   r   r   r   r   Ú_matches   s    zStringMatchesPattern._matches)	Ú__name__Ú
__module__Ú__qualname__r   r   r   ÚstrÚboolr   r   r   r   r   r      s   r   )r   r   c                 C   s   t | tƒrt | ¡} t| ƒS )aK  Matches if object is a string containing a match for a given regular
    expression.

    :param pattern: The regular expression to search for.

    This matcher first checks whether the evaluated object is a string. If so,
    it checks if the regular expression ``pattern`` matches anywhere within the
    evaluated object.

    )Ú
isinstancer   ÚreÚcompiler   r
   r   r   r   Úmatches_regexp   s    

r   )r   Útypingr   r   Zhamcrest.core.base_matcherr   Zhamcrest.core.descriptionr   Zhamcrest.core.matcherr   Ú
__author__Ú__copyright__Ú__license__r   r   r   r   r   r   r   Ú<module>   s   