extended test case
authorStefan Behnel <scoder@users.berlios.de>
Wed, 21 Oct 2009 18:43:30 +0000 (20:43 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Wed, 21 Oct 2009 18:43:30 +0000 (20:43 +0200)
tests/run/locals.pyx

index e0ae907bb5572837ddf35396aeac167969fffd57..8bd2b7c38ebab9ad0c1c80943b5506e4f76f0666 100644 (file)
@@ -1,19 +1,25 @@
 __doc__ = u"""
 >>> sorted( get_locals(1,2,3, k=5) .items())
 [('args', (2, 3)), ('kwds', {'k': 5}), ('x', 1), ('y', 'hi'), ('z', 5)]
-"""
 
-import sys
-IS_PY3 = sys.version_info[0] >= 3
+>>> in_locals('z')
+True
+>>> in_locals('args')
+True
+>>> in_locals('X')
+False
+"""
 
 def get_locals(x, *args, **kwds):
     cdef int z = 5
-    if IS_PY3:
-        y = u"hi"
-    else:
-        y = "hi"
+    y = "hi"
     return locals()
 
+def in_locals(x, *args, **kwds):
+    cdef int z = 5
+    y = "hi"
+    return x in locals()
+
 def sorted(it):
     l = list(it)
     l.sort()