Commit 1342da94 authored by Stefan Behnel's avatar Stefan Behnel

extended test case

parent 51d302f5
...@@ -82,6 +82,38 @@ def all_in_simple_gen(seq): ...@@ -82,6 +82,38 @@ def all_in_simple_gen(seq):
""" """
return all(x for x in seq) return all(x for x in seq)
@cython.test_assert_path_exists("//ForInStatNode")
@cython.test_fail_if_path_exists("//SimpleCallNode",
"//YieldExprNode",
"//GeneratorExpressionNode")
def all_in_conditional_gen(seq):
"""
>>> all_in_conditional_gen([3,6,9])
False
>>> all_in_conditional_gen([0,3,7])
False
>>> all_in_conditional_gen([1,0,1])
True
>>> all_in_conditional_gen(VerboseGetItem([1,1,1,1,1]))
0
1
2
3
4
5
True
>>> all_in_conditional_gen(VerboseGetItem([1,1,0,1,1]))
0
1
2
3
4
5
True
"""
return all(x%3 for x in seq if x%2 == 1)
@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",
......
...@@ -78,6 +78,36 @@ def any_in_simple_gen(seq): ...@@ -78,6 +78,36 @@ def any_in_simple_gen(seq):
""" """
return any(x for x in seq) return any(x for x in seq)
@cython.test_assert_path_exists("//ForInStatNode")
@cython.test_fail_if_path_exists("//SimpleCallNode",
"//YieldExprNode",
"//GeneratorExpressionNode")
def any_in_conditional_gen(seq):
"""
>>> any_in_conditional_gen([3,6,9])
False
>>> any_in_conditional_gen([0,3,7])
True
>>> any_in_conditional_gen([1,0,1])
True
>>> any_in_conditional_gen(VerboseGetItem([0,0,3,0,0]))
0
1
2
3
4
5
False
>>> any_in_conditional_gen(VerboseGetItem([0,3,0,1,1]))
0
1
2
3
True
"""
return any(x%3 for x in seq if x%2 == 1)
@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