From 3d4f1abd9749efbafcfcc7722f3a33cb621bdbf2 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Mon, 17 May 2010 13:04:35 +0200 Subject: [PATCH] extended test cases --- tests/run/all.pyx | 19 +++++++++++++++++++ tests/run/any.pyx | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) 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", -- 2.26.2