Commit 3d4f1abd authored by Stefan Behnel's avatar Stefan Behnel

extended test cases

parent 967f8db2
...@@ -114,6 +114,25 @@ def all_in_conditional_gen(seq): ...@@ -114,6 +114,25 @@ def all_in_conditional_gen(seq):
""" """
return all(x%3 for x in seq if x%2 == 1) return all(x%3 for x in seq if x%2 == 1)
mixed_ustring = u'AbcDefGhIjKlmnoP'
lower_ustring = mixed_ustring.lower()
upper_ustring = mixed_ustring.upper()
@cython.test_assert_path_exists('//PythonCapiCallNode',
'//ForFromStatNode')
@cython.test_fail_if_path_exists('//SimpleCallNode',
'//ForInStatNode')
def all_lower_case_characters(unicode ustring):
"""
>>> all_lower_case_characters(mixed_ustring)
False
>>> all_lower_case_characters(upper_ustring)
False
>>> all_lower_case_characters(lower_ustring)
True
"""
return all(uchar.islower() for uchar in ustring)
@cython.test_assert_path_exists("//ForInStatNode") @cython.test_assert_path_exists("//ForInStatNode")
@cython.test_fail_if_path_exists("//SimpleCallNode", @cython.test_fail_if_path_exists("//SimpleCallNode",
"//YieldExprNode", "//YieldExprNode",
......
...@@ -108,6 +108,25 @@ def any_in_conditional_gen(seq): ...@@ -108,6 +108,25 @@ def any_in_conditional_gen(seq):
""" """
return any(x%3 for x in seq if x%2 == 1) return any(x%3 for x in seq if x%2 == 1)
mixed_ustring = u'AbcDefGhIjKlmnoP'
lower_ustring = mixed_ustring.lower()
upper_ustring = mixed_ustring.upper()
@cython.test_assert_path_exists('//PythonCapiCallNode',
'//ForFromStatNode')
@cython.test_fail_if_path_exists('//SimpleCallNode',
'//ForInStatNode')
def any_lower_case_characters(unicode ustring):
"""
>>> any_lower_case_characters(upper_ustring)
False
>>> any_lower_case_characters(mixed_ustring)
True
>>> any_lower_case_characters(lower_ustring)
True
"""
return any(uchar.islower() for uchar in ustring)
@cython.test_assert_path_exists("//ForInStatNode") @cython.test_assert_path_exists("//ForInStatNode")
@cython.test_fail_if_path_exists("//SimpleCallNode", @cython.test_fail_if_path_exists("//SimpleCallNode",
"//YieldExprNode", "//YieldExprNode",
......
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