From d99d59395e2ee3ae84c20cc073dd0781b26944fd Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Wed, 21 Oct 2009 20:43:30 +0200 Subject: [PATCH] extended test case --- tests/run/locals.pyx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/run/locals.pyx b/tests/run/locals.pyx index e0ae907b..8bd2b7c3 100644 --- a/tests/run/locals.pyx +++ b/tests/run/locals.pyx @@ -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() -- 2.26.2