@@ -420,26 +420,22 @@ def test_rewind_preserves_successful_sub_orchestration():
420420 clean = _get_clean_history (result )
421421
422422 # Sub-orch 1's created + completed should be present.
423- assert any (
424- e .HasField ( " subOrchestrationInstanceCreated" )
425- and e . subOrchestrationInstanceCreated . instanceId == "child-ok-id"
426- for e in clean
427- )
428- assert any (
429- e .HasField ( " subOrchestrationInstanceCompleted" )
430- and e . subOrchestrationInstanceCompleted . taskScheduledId == 1
431- for e in clean
432- )
423+ created_ids = [
424+ e .subOrchestrationInstanceCreated . instanceId
425+ for e in clean if e . HasField ( "subOrchestrationInstanceCreated" )
426+ ]
427+ assert "child-ok-id" in created_ids
428+ completed_sub_ids = [
429+ e .subOrchestrationInstanceCompleted . taskScheduledId
430+ for e in clean if e . HasField ( "subOrchestrationInstanceCompleted" )
431+ ]
432+ assert 1 in completed_sub_ids
433433 # Sub-orch 2's failed event should be removed.
434434 assert not any (
435435 e .HasField ("subOrchestrationInstanceFailed" ) for e in clean
436436 )
437437 # Sub-orch 2's created event should be kept (for backend recursive rewind).
438- assert any (
439- e .HasField ("subOrchestrationInstanceCreated" )
440- and e .subOrchestrationInstanceCreated .instanceId == "child-fail-id"
441- for e in clean
442- )
438+ assert "child-fail-id" in created_ids
443439
444440
445441# ---------------------------------------------------------------------------
@@ -618,26 +614,22 @@ def test_rewind_mixed_activities_and_sub_orchestrations():
618614 assert not any (e .HasField ("taskFailed" ) for e in clean )
619615
620616 # --- Successful sub-orch A preserved ---
621- assert any (
622- e .HasField ( " subOrchestrationInstanceCreated" )
623- and e . subOrchestrationInstanceCreated . instanceId == "child-ok-id"
624- for e in clean
625- )
626- assert any (
627- e .HasField ( " subOrchestrationInstanceCompleted" )
628- and e . subOrchestrationInstanceCompleted . taskScheduledId == 2
629- for e in clean
630- )
617+ created_ids = [
618+ e .subOrchestrationInstanceCreated . instanceId
619+ for e in clean if e . HasField ( "subOrchestrationInstanceCreated" )
620+ ]
621+ assert "child-ok-id" in created_ids
622+ completed_sub_ids = [
623+ e .subOrchestrationInstanceCompleted . taskScheduledId
624+ for e in clean if e . HasField ( "subOrchestrationInstanceCompleted" )
625+ ]
626+ assert 2 in completed_sub_ids
631627
632628 # --- Failed sub-orch B: failed event removed, created kept ---
633629 assert not any (
634630 e .HasField ("subOrchestrationInstanceFailed" ) for e in clean
635631 )
636- assert any (
637- e .HasField ("subOrchestrationInstanceCreated" )
638- and e .subOrchestrationInstanceCreated .instanceId == "child-fail-id"
639- for e in clean
640- )
632+ assert "child-fail-id" in created_ids
641633
642634 # --- executionCompleted removed ---
643635 assert not any (e .HasField ("executionCompleted" ) for e in clean )
@@ -674,10 +666,8 @@ def test_rewind_does_not_mutate_original_events():
674666 TEST_INSTANCE_ID , "orch" , old_events , new_events )
675667
676668 # The original executionStarted event should NOT be mutated.
677- assert (
678- es_event .executionStarted .orchestrationInstance .executionId .value
679- == original_exec_id
680- )
669+ actual = es_event .executionStarted .orchestrationInstance .executionId .value
670+ assert actual == original_exec_id
681671
682672
683673def test_rewind_result_action_structure ():
0 commit comments