From: Stefan Behnel Date: Mon, 17 May 2010 11:04:35 +0000 (+0200) Subject: extended test cases X-Git-Tag: 0.13.beta0~2^2~56^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3d4f1abd9749efbafcfcc7722f3a33cb621bdbf2;p=cython.git extended test cases --- diff --git a/tests/run/all.pyx b/tests/run/all.pyx index b2b9f1ae..61660be2 100644 --- a/tests/run/all.pyx +++ b/tests/run/all.pyx @@ -114,6 +114,25 @@ def all_in_conditional_gen(seq): """ 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_fail_if_path_exists("//SimpleCallNode", "//YieldExprNode", diff --git a/tests/run/any.pyx b/tests/run/any.pyx index 6234bc3f..0be74849 100644 --- a/tests/run/any.pyx +++ b/tests/run/any.pyx @@ -108,6 +108,25 @@ def any_in_conditional_gen(seq): """ 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_fail_if_path_exists("//SimpleCallNode", "//YieldExprNode",