Commit 1473fe37 by Ned Batchelder

A unit test that demonstrates the problem we're having with some sandboxed code.

parent d9df65ee
"""Test safe_exec.py"""
import os.path
import textwrap
import unittest
from nose.plugins.skip import SkipTest
......@@ -42,6 +43,17 @@ class SafeExecTests(object):
)
self.assertEqual(l['a'], 42)
def test_functions_calling_each_other(self):
g, l = {}, {}
self.safe_exec(textwrap.dedent("""\
def f():
return 1723
def g():
return f()
x = g()
"""), g, l)
self.assertEqual(l['x'], 1723)
class TestSafeExec(SafeExecTests, unittest.TestCase):
"""Run SafeExecTests, with the real safe_exec."""
......
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