Py3 locals test
authorStefan Behnel <scoder@users.berlios.de>
Mon, 22 Nov 2010 07:45:19 +0000 (08:45 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Mon, 22 Nov 2010 07:45:19 +0000 (08:45 +0100)
tests/run/cython3.pyx

index 04a569bbb1cb0907025ed0206ae94250af06e931..1712998633896ea3d93937b10c67dd588e4e5940 100644 (file)
@@ -17,6 +17,19 @@ def print_function(*args):
     """
     print(*args) # this isn't valid Py2 syntax
 
+def locals_function(a, b=2):
+    """
+    >>> items = list(locals_function(1).items())
+    >>> items.sort()
+    >>> for item in items:
+    ...     print('%s = %r' % item)
+    a = 1
+    b = 2
+    x = 'abc'
+    """
+    x = 'abc'
+    return locals()
+
 def exec3_function(cmd):
     """
     >>> exec3_function('a = 1+1')['a']