Exemplo n.º 1
0
def test_load_extension():
    sys.modules['ipython_context'] = MockIpythonContext
    load_ipython_extension(None)
    assert MockIpythonContext.context is Context.current_context()
    unload_ipython_extension(None)
    assert MockIpythonContext is not Context.current_context()
    sys.modules['ipython_context'] = None
Exemplo n.º 2
0
def test_context_manager():
    e = Context()
    with e:
        assert Context.current_context() is e
    assert Context.current_context() is not e
Exemplo n.º 3
0
 def test():
     assert e is not Context.current_context()