From: Stefan Behnel Date: Thu, 20 Aug 2009 20:01:21 +0000 (+0200) Subject: extended test cases X-Git-Tag: 0.12.alpha0~251 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=82d6bc7d590fa6ef608f3e32d97e6718d0415a25;p=cython.git extended test cases --- diff --git a/tests/run/inop.pyx b/tests/run/inop.pyx index 2b9c693c..76fbd776 100644 --- a/tests/run/inop.pyx +++ b/tests/run/inop.pyx @@ -37,6 +37,15 @@ __doc__ = u""" 1 >>> n('xxx') 0 + + >>> p(1) + 0 + >>> p('a') + 1 + + >>> q(1) + Traceback (most recent call last): + TypeError: 'NoneType' object is not iterable """ def f(a,b): @@ -68,3 +77,13 @@ def m(int a): def n(a): cdef int result = a.lower() in [u'a *',u'b *',u'c *',u'd *'] return result + +def p(a): + cdef dict d = {u'a': 1, u'b': 2} + cdef int result = a in d + return result + +def q(a): + cdef dict d = None + cdef int result = a in d # should fail with a TypeError + return result diff --git a/tests/run/notinop.pyx b/tests/run/notinop.pyx index 0ad223da..30582535 100644 --- a/tests/run/notinop.pyx +++ b/tests/run/notinop.pyx @@ -37,6 +37,15 @@ __doc__ = u""" 0 >>> n('xxx') 1 + + >>> p('a') + 0 + >>> p(1) + 1 + + >>> q(1) + Traceback (most recent call last): + TypeError: 'NoneType' object is not iterable """ def f(a,b): @@ -68,3 +77,13 @@ def m(int a): def n(a): cdef int result = a.lower() not in [u'a *',u'b *',u'c *',u'd *'] return result + +def p(a): + cdef dict d = {u'a': 1, u'b': 2} + cdef int result = a not in d + return result + +def q(a): + cdef dict d = None + cdef int result = a not in d # should fail with a TypeError + return result