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/stringendswith.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/stringendswith.py')
-rw-r--r-- | contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py index 43f9c3d302..6ccfbb2de0 100644 --- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py +++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringendswith.py @@ -1,39 +1,39 @@ -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 StringEndsWith(SubstringMatcher): - - def __init__(self, substring): - super(StringEndsWith, self).__init__(substring) - - def _matches(self, item): - if not hasmethod(item, 'endswith'): - return False - return item.endswith(self.substring) - - def relationship(self): - return 'ending with' - - -def ends_with(string): - """Matches if object is a string ending with 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 if ``string`` matches the ending characters of the evaluated - object. - - Example:: - - ends_with("bar") - - will match "foobar". - - """ - return StringEndsWith(string) +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 StringEndsWith(SubstringMatcher): + + def __init__(self, substring): + super(StringEndsWith, self).__init__(substring) + + def _matches(self, item): + if not hasmethod(item, 'endswith'): + return False + return item.endswith(self.substring) + + def relationship(self): + return 'ending with' + + +def ends_with(string): + """Matches if object is a string ending with 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 if ``string`` matches the ending characters of the evaluated + object. + + Example:: + + ends_with("bar") + + will match "foobar". + + """ + return StringEndsWith(string) |