diff --git a/tests/run/locals.pyx b/tests/run/locals.pyx index e0ae907bb5572837ddf35396aeac167969fffd57..8bd2b7c38ebab9ad0c1c80943b5506e4f76f0666 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()