Commit 50b15073 authored by Stefan Behnel's avatar Stefan Behnel

new test case for locals()

parent d99d5939
...@@ -9,3 +9,4 @@ bad_c_struct_T252 ...@@ -9,3 +9,4 @@ bad_c_struct_T252
missing_baseclass_in_predecl_T262 missing_baseclass_in_predecl_T262
extended_unpacking_T409 extended_unpacking_T409
locals_rebind_T429 locals_rebind_T429
locals_expressions_T430
__doc__ = u"""
>>> sorted( get_locals(1,2,3, k=5) .items())
[('args', (2, 3)), ('kwds', {'k': 5}), ('x', 1), ('y', 'hi'), ('z', 5)]
>>> sorted(get_locals_items())
[('args', (2, 3)), ('kwds', {'k': 5}), ('x', 1), ('y', 'hi'), ('z', 5)]
>>> sorted(get_locals_items_listcomp())
[('args', (2, 3)), ('kwds', {'k': 5}), ('x', 1), ('y', 'hi'), ('z', 5)]
"""
def get_locals(x, *args, **kwds):
cdef int z = 5
y = "hi"
return locals()
def get_locals_items(x, *args, **kwds):
cdef int z = 5
y = "hi"
return locals().items()
def get_locals_items_listcomp(x, *args, **kwds):
cdef int z = 5
y = "hi"
return [ item for item in locals().items() ]
def sorted(it):
l = list(it)
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