From 34e5ca800ce7942cbe2ad3a5033c602b6f7bd1b5 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 5 Dec 2008 10:22:09 +0100 Subject: [PATCH] extended test case for dict iteration in list comprehensions --- tests/run/iterdict.pyx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- 2.26.2