Commit 769720a1 authored by Stefan Behnel's avatar Stefan Behnel

Py2.4 test fixes

parent a9876b7b
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
cimport cython cimport cython
import sys
PY_VERSION = sys.version_info
text = u'ab jd sdflk as sa sadas asdas fsdf ' text = u'ab jd sdflk as sa sadas asdas fsdf '
sep = u' ' sep = u' '
...@@ -228,14 +232,14 @@ def startswith(unicode s, sub): ...@@ -228,14 +232,14 @@ def startswith(unicode s, sub):
>>> startswith(text, 'ab X') >>> startswith(text, 'ab X')
'NO MATCH' 'NO MATCH'
>>> text.startswith(('ab', 'ab ')) >>> PY_VERSION < (2,5) or text.startswith(('ab', 'ab '))
True
>>> PY_VERSION < (2,5) or startswith(text, ('ab', 'ab ')) == 'MATCH'
True
>>> PY_VERSION < (2,5) or not text.startswith((' ab', 'ab X'))
True
>>> PY_VERSION < (2,5) or startswith(text, (' ab', 'ab X')) == 'NO MATCH'
True True
>>> startswith(text, ('ab', 'ab '))
'MATCH'
>>> text.startswith((' ab', 'ab X'))
False
>>> startswith(text, (' ab', 'ab X'))
'NO MATCH'
""" """
if s.startswith(sub): if s.startswith(sub):
return 'MATCH' return 'MATCH'
...@@ -284,14 +288,14 @@ def endswith(unicode s, sub): ...@@ -284,14 +288,14 @@ def endswith(unicode s, sub):
>>> endswith(text, 'fsdf X') >>> endswith(text, 'fsdf X')
'NO MATCH' 'NO MATCH'
>>> text.endswith(('fsdf', 'fsdf ')) >>> PY_VERSION < (2,5) or text.endswith(('fsdf', 'fsdf '))
True
>>> PY_VERSION < (2,5) or endswith(text, ('fsdf', 'fsdf ')) == 'MATCH'
True
>>> PY_VERSION < (2,5) or not text.endswith(('fsdf', 'fsdf X'))
True
>>> PY_VERSION < (2,5) or endswith(text, ('fsdf', 'fsdf X')) == 'NO MATCH'
True True
>>> endswith(text, ('fsdf', 'fsdf '))
'MATCH'
>>> text.endswith(('fsdf', 'fsdf X'))
False
>>> endswith(text, ('fsdf', 'fsdf X'))
'NO MATCH'
""" """
if s.endswith(sub): if s.endswith(sub):
return 'MATCH' return 'MATCH'
...@@ -315,14 +319,14 @@ def endswith_start_end(unicode s, sub, start, end): ...@@ -315,14 +319,14 @@ def endswith_start_end(unicode s, sub, start, end):
>>> endswith_start_end(text, 'fsdf ', 10, len(text)-1) >>> endswith_start_end(text, 'fsdf ', 10, len(text)-1)
'NO MATCH' 'NO MATCH'
>>> text.endswith(('fsd', 'fsdf'), 10, len(text)-1) >>> PY_VERSION < (2,5) or text.endswith(('fsd', 'fsdf'), 10, len(text)-1)
True
>>> PY_VERSION < (2,5) or endswith_start_end(text, ('fsd', 'fsdf'), 10, len(text)-1) == 'MATCH'
True
>>> PY_VERSION < (2,5) or not text.endswith(('fsdf ', 'fsdf X'), 10, len(text)-1)
True
>>> PY_VERSION < (2,5) or endswith_start_end(text, ('fsdf ', 'fsdf X'), 10, len(text)-1) == 'NO MATCH'
True True
>>> endswith_start_end(text, ('fsd', 'fsdf'), 10, len(text)-1)
'MATCH'
>>> text.endswith(('fsdf ', 'fsdf X'), 10, len(text)-1)
False
>>> endswith_start_end(text, ('fsdf ', 'fsdf X'), 10, len(text)-1)
'NO MATCH'
""" """
if s.endswith(sub, start, end): if s.endswith(sub, start, end):
return 'MATCH' return 'MATCH'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment