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/stringstartswith.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/stringstartswith.py')
-rw-r--r-- | contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py index a0af49c9c2..19a1ec4f06 100644 --- a/contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py +++ b/contrib/python/PyHamcrest/src/hamcrest/library/text/stringstartswith.py @@ -1,39 +1,39 @@ -__author__ = "Jon Reid" -__copyright__ = "Copyright 2011 hamcrest.org" -__license__ = "BSD, see License.txt" - -from hamcrest.library.text.substringmatcher import SubstringMatcher -from hamcrest.core.helpers.hasmethod import hasmethod - - -class StringStartsWith(SubstringMatcher): - - def __init__(self, substring): - super(StringStartsWith, self).__init__(substring) - - def _matches(self, item): - if not hasmethod(item, 'startswith'): - return False - return item.startswith(self.substring) - - def relationship(self): - return 'starting with' - - -def starts_with(substring): - """Matches if object is a string starting 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 beginning characters of the evaluated - object. - - Example:: - - starts_with("foo") - - will match "foobar". - - """ - return StringStartsWith(substring) +__author__ = "Jon Reid" +__copyright__ = "Copyright 2011 hamcrest.org" +__license__ = "BSD, see License.txt" + +from hamcrest.library.text.substringmatcher import SubstringMatcher +from hamcrest.core.helpers.hasmethod import hasmethod + + +class StringStartsWith(SubstringMatcher): + + def __init__(self, substring): + super(StringStartsWith, self).__init__(substring) + + def _matches(self, item): + if not hasmethod(item, 'startswith'): + return False + return item.startswith(self.substring) + + def relationship(self): + return 'starting with' + + +def starts_with(substring): + """Matches if object is a string starting 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 beginning characters of the evaluated + object. + + Example:: + + starts_with("foo") + + will match "foobar". + + """ + return StringStartsWith(substring) |