From bcf510fa88e1f891c54e9ab0ec46ced2995a5ee9 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sun, 7 Dec 2008 19:09:55 +0100 Subject: [PATCH] extended test case for in/not-in operator --- tests/run/inop.pyx | 23 +++++++++++++++++++++++ tests/run/notinop.pyx | 27 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/tests/run/inop.pyx b/tests/run/inop.pyx index dccfe646..c7ba3768 100644 --- a/tests/run/inop.pyx +++ b/tests/run/inop.pyx @@ -22,6 +22,21 @@ __doc__ = u""" 1 >>> j([1,3,4]) 0 + + >>> k(1) + 1 + >>> k(5) + 0 + + >>> m(2) + 1 + >>> m(5) + 0 + + >>> n('d *') + 1 + >>> n('xxx') + 0 """ def f(a,b): @@ -45,3 +60,11 @@ def j(b): def k(a): cdef int result = a in [1,2,3,4] return result + +def m(int a): + cdef int result = a in [1,2,3,4] + return result + +def n(a): + cdef int result = a.lower() in ['a *','b *','c *','d *'] + return result diff --git a/tests/run/notinop.pyx b/tests/run/notinop.pyx index 99a24181..9271df0f 100644 --- a/tests/run/notinop.pyx +++ b/tests/run/notinop.pyx @@ -22,6 +22,21 @@ __doc__ = u""" 0 >>> j([1,3,4]) 1 + + >>> k(1) + 0 + >>> k(5) + 1 + + >>> m(2) + 0 + >>> m(5) + 1 + + >>> n('d *') + 0 + >>> n('xxx') + 1 """ def f(a,b): @@ -41,3 +56,15 @@ def j(b): cdef int result result = 2 not in b return result + +def k(a): + cdef int result = a not in [1,2,3,4] + return result + +def m(int a): + cdef int result = a not in [1,2,3,4] + return result + +def n(a): + cdef int result = a.lower() not in ['a *','b *','c *','d *'] + return result -- 2.26.2