Commit 82d6bc7d authored by Stefan Behnel's avatar Stefan Behnel

extended test cases

parent 19fee9ac
...@@ -37,6 +37,15 @@ __doc__ = u""" ...@@ -37,6 +37,15 @@ __doc__ = u"""
1 1
>>> n('xxx') >>> n('xxx')
0 0
>>> p(1)
0
>>> p('a')
1
>>> q(1)
Traceback (most recent call last):
TypeError: 'NoneType' object is not iterable
""" """
def f(a,b): def f(a,b):
...@@ -68,3 +77,13 @@ def m(int a): ...@@ -68,3 +77,13 @@ def m(int a):
def n(a): def n(a):
cdef int result = a.lower() in [u'a *',u'b *',u'c *',u'd *'] cdef int result = a.lower() in [u'a *',u'b *',u'c *',u'd *']
return result 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
...@@ -37,6 +37,15 @@ __doc__ = u""" ...@@ -37,6 +37,15 @@ __doc__ = u"""
0 0
>>> n('xxx') >>> n('xxx')
1 1
>>> p('a')
0
>>> p(1)
1
>>> q(1)
Traceback (most recent call last):
TypeError: 'NoneType' object is not iterable
""" """
def f(a,b): def f(a,b):
...@@ -68,3 +77,13 @@ def m(int a): ...@@ -68,3 +77,13 @@ def m(int a):
def n(a): def n(a):
cdef int result = a.lower() not in [u'a *',u'b *',u'c *',u'd *'] cdef int result = a.lower() not in [u'a *',u'b *',u'c *',u'd *']
return result 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
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