def test_promise_return():
    '\n    Testing that when a workflow is local executed but a local wf execution context already exists, Promise objects\n    are returned wrapping Flyte literals instead of the unpacked dict.\n    '

    @task
    def t1(a: int) -> typing.NamedTuple('OutputsBC', t1_int_output=int, c=str):
        a = (a + 2)
        return (a, ('world-' + str(a)))

    @workflow
    def mimic_sub_wf(a: int) -> (str, str):
        (x, y) = t1(a=a)
        (u, v) = t1(a=x)
        return (y, v)
    ctx = context_manager.FlyteContext.current_context()
    with ctx.new_execution_context(mode=ExecutionState.Mode.LOCAL_WORKFLOW_EXECUTION) as ctx:
        (a, b) = mimic_sub_wf(a=3)
    assert isinstance(a, promise.Promise)
    assert isinstance(b, promise.Promise)
    assert (a.val.scalar.value.string_value == 'world-5')
    assert (b.val.scalar.value.string_value == 'world-7')
Testing that when a workflow is local executed but a local wf execution context already exists, Promise objects
are returned wrapping Flyte literals instead of the unpacked dict.
def test_promise_return():
    '\n    Testing that when a workflow is local executed but a local wf execution context already exists, Promise objects\n    are returned wrapping Flyte literals instead of the unpacked dict.\n    '

    @task
    def t1(a: int) -> typing.NamedTuple('OutputsBC', t1_int_output=int, c=str):
        a = (a + 2)
        return (a, ('world-' + str(a)))

    @workflow
    def mimic_sub_wf(a: int) -> (str, str):
        (x, y) = t1(a=a)
        (u, v) = t1(a=x)
        return (y, v)
    ctx = context_manager.FlyteContext.current_context()
    with ctx.new_execution_context(mode=ExecutionState.Mode.LOCAL_WORKFLOW_EXECUTION) as ctx:
        (a, b) = mimic_sub_wf(a=3)
    assert isinstance(a, promise.Promise)
    assert isinstance(b, promise.Promise)
    assert (a.val.scalar.value.string_value == 'world-5')
    assert (b.val.scalar.value.string_value == 'world-7')