U
    ôbÛV  ã                   @   sP   d Z dZdZddlZddlZddlmZ ddlmZ G dd„ deƒZ	d	d
„ Z
dS )z
Chris RosezCopyright 2011 hamcrest.orgzBSD, see License.txté    N)ÚBaseMatcher)Ú	hasmethodc                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚStringMatchesPatternc                 C   s
   || _ d S ©N©Úpattern)Úselfr   © r	   úE/usr/lib/python3/dist-packages/hamcrest/library/text/stringmatches.pyÚ__init__   s    zStringMatchesPattern.__init__c                 C   s   |  d¡  | jj¡  d¡ d S )Nza string matching 'ú')Zappend_textr   )r   Zdescriptionr	   r	   r
   Údescribe_to   s
    
ÿþz StringMatchesPattern.describe_toc                 C   s   | j  |¡d k	S r   )r   Úsearch)r   Úitemr	   r	   r
   Ú_matches   s    zStringMatchesPattern._matchesN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r	   r	   r	   r
   r      s   r   c                 C   s   t | tjƒ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.

    )Ú
isinstanceÚsixZstring_typesÚreÚcompiler   r   r	   r	   r
   Úmatches_regexp   s    
r   )Ú
__author__Z__copyright__Z__license__r   r   Zhamcrest.core.base_matcherr   Zhamcrest.core.helpers.hasmethodr   r   r   r	   r	   r	   r
   Ú<module>   s   