o
    (]^Ñ  ã                   @   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deeee f de	e f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„Zdeddfdd„Zdedefd	d
„ZdS )ÚStringMatchesPatternÚreturnNc                 C   s
   || _ d S ©N©Úpattern)Úselfr   © r   úE/usr/lib/python3/dist-packages/hamcrest/library/text/stringmatches.pyÚ__init__   s   
zStringMatchesPattern.__init__Údescriptionc                 C   s   |  d¡  | jj¡  d¡ d S )Nza string matching 'ú')Úappend_textr   )r   r   r   r   r   Údescribe_to   s   
ÿz StringMatchesPattern.describe_toÚitemc                 C   s   | j  |¡d uS r	   )r   Úsearch)r   r   r   r   r   Ú_matches   s   zStringMatchesPattern._matches)r   N)	Ú__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   Úhamcrest.core.base_matcherr   Úhamcrest.core.descriptionr   Úhamcrest.core.matcherr   Ú
__author__Ú__copyright__Ú__license__r   r   r   r   r   r   r   Ú<module>   s    &