Commit b02f373a authored by Stefan Behnel's avatar Stefan Behnel

add tests for non-loop usage of dict.iter*() methods

parent 90d7ebdb
......@@ -4,6 +4,40 @@ cimport cython
dict_size = 4
d = dict(zip(range(10,dict_size+10), range(dict_size)))
def dict_iteritems(dict d):
"""
>>> it = dict_iteritems(d)
>>> type(it) is list
False
>>> sorted(it)
[(10, 0), (11, 1), (12, 2), (13, 3)]
"""
return d.iteritems()
def dict_iterkeys(dict d):
"""
>>> it = dict_iterkeys(d)
>>> type(it) is list
False
>>> sorted(it)
[10, 11, 12, 13]
"""
return d.iterkeys()
def dict_itervalues(dict d):
"""
>>> it = dict_itervalues(d)
>>> type(it) is list
False
>>> sorted(it)
[0, 1, 2, 3]
"""
return d.itervalues()
@cython.test_fail_if_path_exists(
"//WhileStatNode")
def items(dict d):
......
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