Commit 34e5ca80 authored by Stefan Behnel's avatar Stefan Behnel

extended test case for dict iteration in list comprehensions

parent e3dc3b21
...@@ -55,6 +55,11 @@ def iteritems_tuple(dict d): ...@@ -55,6 +55,11 @@ def iteritems_tuple(dict d):
l.sort() l.sort()
return l 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): def iterkeys(dict d):
l = [] l = []
for k in d.iterkeys(): for k in d.iterkeys():
...@@ -94,6 +99,11 @@ def iterdict_reassign(dict d): ...@@ -94,6 +99,11 @@ def iterdict_reassign(dict d):
l.sort() l.sort()
return l return l
def iterdict_listcomp(dict d):
cdef list l = [k for k in d]
l.sort()
return l
def itervalues(dict d): def itervalues(dict d):
l = [] l = []
for v in d.itervalues(): for v in d.itervalues():
...@@ -108,3 +118,8 @@ def itervalues_int(dict d): ...@@ -108,3 +118,8 @@ def itervalues_int(dict d):
l.append(v) l.append(v)
l.sort() l.sort()
return l return l
def itervalues_listcomp(dict d):
cdef list l = [v for v in d.itervalues()]
l.sort()
return l
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