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 | 4ca29390ac54b7877174de542de47532c67453b5 (patch) | |
tree | 14f6fc2edf989ce65a7555e8882e3eae3e9306fe /contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py | |
parent | 05f59b2581f074c756adaee6b260014ac3a0c3ec (diff) | |
download | ydb-4ca29390ac54b7877174de542de47532c67453b5.tar.gz |
Restoring authorship annotation for <asatarin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py')
-rw-r--r-- | contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py index 58ffd283c6..e309b5a116 100644 --- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py +++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringcontains.py @@ -1,38 +1,38 @@ -from hamcrest.library.text.substringmatcher import SubstringMatcher -from hamcrest.core.helpers.hasmethod import hasmethod - -__author__ = "Jon Reid" -__copyright__ = "Copyright 2011 hamcrest.org" -__license__ = "BSD, see License.txt" - - -class StringContains(SubstringMatcher): - - def __init__(self, substring): - super(StringContains, self).__init__(substring) - - def _matches(self, item): - if not hasmethod(item, 'find'): - return False - return item.find(self.substring) >= 0 - - def relationship(self): - return 'containing' - - -def contains_string(substring): - """Matches if object is a string containing a given string. - - :param string: The string to search for. - - This matcher first checks whether the evaluated object is a string. If so, - it checks whether it contains ``string``. - - Example:: - - contains_string("def") - - will match "abcdefg". - - """ - return StringContains(substring) +from hamcrest.library.text.substringmatcher import SubstringMatcher +from hamcrest.core.helpers.hasmethod import hasmethod + +__author__ = "Jon Reid" +__copyright__ = "Copyright 2011 hamcrest.org" +__license__ = "BSD, see License.txt" + + +class StringContains(SubstringMatcher): + + def __init__(self, substring): + super(StringContains, self).__init__(substring) + + def _matches(self, item): + if not hasmethod(item, 'find'): + return False + return item.find(self.substring) >= 0 + + def relationship(self): + return 'containing' + + +def contains_string(substring): + """Matches if object is a string containing a given string. + + :param string: The string to search for. + + This matcher first checks whether the evaluated object is a string. If so, + it checks whether it contains ``string``. + + Example:: + + contains_string("def") + + will match "abcdefg". + + """ + return StringContains(substring) |