← Back
Editing: stringmatches.cpython-38.pyc
U �b�V � @ sP d Z dZdZddlZddlZddlmZ ddlmZ G dd� de�Z d d � Z dS )z Chris RosezCopyright 2011 hamcrest.orgzBSD, see License.txt� N)�BaseMatcher)� hasmethodc @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�StringMatchesPatternc C s || _ d S �N��pattern)�selfr � r �E/usr/lib/python3/dist-packages/hamcrest/library/text/stringmatches.py�__init__ s zStringMatchesPattern.__init__c C s |� d�� | jj�� d� d S )Nza string matching '�')Zappend_textr )r Zdescriptionr r r �describe_to s ��z StringMatchesPattern.describe_toc C s | j �|�d k S r )r �search)r �itemr r r �_matches s zStringMatchesPattern._matchesN)�__name__� __module__�__qualname__r r r r r r r r s r c C s t | tj�rt�| �} 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�sixZstring_types�re�compiler r r r r �matches_regexp s r )� __author__Z __copyright__Z__license__r r Zhamcrest.core.base_matcherr Zhamcrest.core.helpers.hasmethodr r r r r r r �<module> s
Save File
Cancel