From: Stefan Behnel Date: Fri, 5 Dec 2008 09:22:09 +0000 (+0100) Subject: extended test case for dict iteration in list comprehensions X-Git-Tag: 0.11-beta~156 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=34e5ca800ce7942cbe2ad3a5033c602b6f7bd1b5;p=cython.git extended test case for dict iteration in list comprehensions --- diff --git a/tests/run/iterdict.pyx b/tests/run/iterdict.pyx index b541f957..87fe41b4 100644 --- a/tests/run/iterdict.pyx +++ b/tests/run/iterdict.pyx @@ -55,6 +55,11 @@ def iteritems_tuple(dict d): l.sort() return l +def iteritems_listcomp(dict d): + cdef list l = [(k,v) for k,v in d.iteritems()] + l.sort() + return l + def iterkeys(dict d): l = [] for k in d.iterkeys(): @@ -94,6 +99,11 @@ def iterdict_reassign(dict d): l.sort() return l +def iterdict_listcomp(dict d): + cdef list l = [k for k in d] + l.sort() + return l + def itervalues(dict d): l = [] for v in d.itervalues(): @@ -108,3 +118,8 @@ def itervalues_int(dict d): l.append(v) l.sort() return l + +def itervalues_listcomp(dict d): + cdef list l = [v for v in d.itervalues()] + l.sort() + return l