diff options
author | asatarin <asatarin@yandex-team.ru> | 2022-02-10 16:47:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:30 +0300 |
commit | ca04a556317a80ac802f38457a2292185282878b (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py | |
parent | 4ca29390ac54b7877174de542de47532c67453b5 (diff) | |
download | ydb-ca04a556317a80ac802f38457a2292185282878b.tar.gz |
Restoring authorship annotation for <asatarin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py')
-rw-r--r-- | contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py index 0f66b9dce5..2a16e29729 100644 --- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py +++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringmatches.py @@ -1,40 +1,40 @@ -__author__ = "Chris Rose" -__copyright__ = "Copyright 2011 hamcrest.org" -__license__ = "BSD, see License.txt" - -import re - -import six - -from hamcrest.core.base_matcher import BaseMatcher -from hamcrest.core.helpers.hasmethod import hasmethod - -class StringMatchesPattern(BaseMatcher): - - def __init__(self, pattern): - self.pattern = pattern - - def describe_to(self, description): - description.append_text("a string matching '") \ - .append_text(self.pattern.pattern) \ - .append_text("'") - - def _matches(self, item): - return self.pattern.search(item) is not None - - -def matches_regexp(pattern): - """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. - - """ - if isinstance(pattern, six.string_types): - pattern = re.compile(pattern) - - return StringMatchesPattern(pattern) +__author__ = "Chris Rose" +__copyright__ = "Copyright 2011 hamcrest.org" +__license__ = "BSD, see License.txt" + +import re + +import six + +from hamcrest.core.base_matcher import BaseMatcher +from hamcrest.core.helpers.hasmethod import hasmethod + +class StringMatchesPattern(BaseMatcher): + + def __init__(self, pattern): + self.pattern = pattern + + def describe_to(self, description): + description.append_text("a string matching '") \ + .append_text(self.pattern.pattern) \ + .append_text("'") + + def _matches(self, item): + return self.pattern.search(item) is not None + + +def matches_regexp(pattern): + """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. + + """ + if isinstance(pattern, six.string_types): + pattern = re.compile(pattern) + + return StringMatchesPattern(pattern) |