extended test cases
authorStefan Behnel <scoder@users.berlios.de>
Mon, 17 May 2010 11:04:35 +0000 (13:04 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Mon, 17 May 2010 11:04:35 +0000 (13:04 +0200)
tests/run/all.pyx
tests/run/any.pyx

index b2b9f1ae2b82a83966a20461d687405167c5043b..61660be267d17cad5d54c3d3eb278fbabe37facb 100644 (file)
@@ -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",
index 6234bc3f7988eb849b8a2d0187254a74daecd4b9..0be7484909fd866260e83f23411d80cb95b95339 100644 (file)
@@ -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",