2323# This import must happen before other invoke imports or test in other files(!!) break
2424from tests .test_nodes import (
2525 AnyTypeTestInvocation ,
26+ AnyTypeTestInvocationOutput ,
2627 PromptCollectionTestInvocation ,
2728 PromptTestInvocation ,
2829 TextToImageTestInvocation ,
@@ -847,9 +848,14 @@ def test_prepare_if_inputs_raises_when_selected_branch_source_has_no_result():
847848 g ._resolved_if_exec_branches [if_exec_id ] = "true_input"
848849
849850 if_node = g .execution_graph .get_node (if_exec_id )
850- with pytest .raises (RuntimeError , match = "selected input edge" ) :
851+ with pytest .raises (RuntimeError ) as exc_info :
851852 g ._prepare_inputs (if_node )
852853
854+ message = str (exc_info .value )
855+ assert if_exec_id in message
856+ assert true_value_exec_id in message
857+ assert "iteration_path=()" in message
858+
853859
854860def test_get_collect_iteration_mappings_ignores_skipped_prepared_exec_nodes ():
855861 graph = Graph ()
@@ -957,7 +963,7 @@ def test_mark_exec_node_skipped_does_not_hide_already_executed_results():
957963 g = GraphExecutionState (graph = graph )
958964
959965 exec_id = g ._create_execution_node ("value" , [])[0 ]
960- g .results [exec_id ] = AnyTypeTestInvocation ( id = "result" , value = "value" ). invoke ( Mock ( InvocationContext ) )
966+ g .results [exec_id ] = AnyTypeTestInvocationOutput ( value = "value" )
961967 g .executed .add (exec_id )
962968 g ._set_prepared_exec_state (exec_id , "executed" )
963969
@@ -967,6 +973,21 @@ def test_mark_exec_node_skipped_does_not_hide_already_executed_results():
967973 assert g .results [exec_id ].value == "value"
968974
969975
976+ def test_mark_exec_node_skipped_is_idempotent_for_skipped_state ():
977+ graph = Graph ()
978+ graph .add_node (AnyTypeTestInvocation (id = "value" , value = "value" ))
979+
980+ g = GraphExecutionState (graph = graph )
981+
982+ exec_id = g ._create_execution_node ("value" , [])[0 ]
983+
984+ g ._if_scheduler ().mark_exec_node_skipped (exec_id )
985+ g ._if_scheduler ().mark_exec_node_skipped (exec_id )
986+
987+ assert g ._get_prepared_exec_metadata (exec_id ).state == "skipped"
988+ assert g .executed_history .count ("value" ) == 1
989+
990+
970991def test_are_connection_types_compatible_accepts_subclass_to_base ():
971992 """A subclass output should be connectable to a base-class input.
972993
0 commit comments