Permalink
Browse files

Add test for accessing global namespace inside functions.

  • Loading branch information...
1 parent 66c14cf commit 3590d111b2c6bf223c9c5e036300654ce636259c @takluyver committed Apr 16, 2011
Showing with 8 additions and 0 deletions.
  1. +8 −0 IPython/core/tests/test_interactiveshell.py
@@ -102,6 +102,14 @@ def test_can_pickle(self):
from cPickle import dumps
res = dumps(ip.user_ns["w"])
self.assertTrue(isinstance(res, bytes))
+
+ def test_global_ns(self):
+ ip = get_ipython()
+ ip.run_cell("a = 10")
+ ip.run_cell(("def f(x):"
+ " return x + a"))
+ ip.run_cell("b = f(12)")
+ self.assertEqual(ip.user_ns["b"], 22)

0 comments on commit 3590d11

Please sign in to comment.