def testRequiresIPythonExecutes(self):
        self.foo_called = False

        def foo():
            self.foo_called = True

        interactive_context.requires_ipython(foo)()
        self.assertTrue(self.foo_called)
    def testRequiresIPythonNoOp(self):
        del builtins.__dict__['__IPYTHON__']

        self.foo_called = False

        def foo():
            self.foo_called = True

        interactive_context.requires_ipython(foo)()
        self.assertFalse(self.foo_called)