From 82d6bc7d590fa6ef608f3e32d97e6718d0415a25 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 20 Aug 2009 22:01:21 +0200 Subject: [PATCH] extended test cases --- tests/run/inop.pyx | 19 +++++++++++++++++++ tests/run/notinop.pyx | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) 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 -- 2.26.2