def stack(app): assert get_current() is app.stack.top assert current.application is app first_env = get_current() with app.contextbound(create_environ()) as second_env: assert get_current() is not first_env assert get_current() is second_env assert get_current() is first_env
def unbound_contexts(): with raises(UnboundContextError): get_current() with raises(UnboundContextError): current.application