File tree Expand file tree Collapse file tree
tests/usethis/_integrations/ci/bitbucket Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -506,6 +506,9 @@ def _get_instructions_for_insertion(
506506
507507 endpoints .append (endpoint )
508508 instructions_per_sub .append (new_instructions )
509+ if min_endpoint is None :
510+ # If the existing components are empty...
511+ min_endpoint = after
509512
510513 for idx in range (len (component .root )):
511514 if idx != min_idx and instructions_per_sub [idx ]:
Original file line number Diff line number Diff line change @@ -774,6 +774,22 @@ def test_empty_series_with_smaller_after(self):
774774 assert instructions == [InsertSuccessor (step = "C" , after = "A" )]
775775 assert endpoint == "C"
776776
777+ def test_all_empty_branches_preserves_after (self ):
778+ """When all branches are empty, no instructions are produced but the
779+ endpoint should still be the original ``after`` value."""
780+ # Arrange
781+ component = parallel (series (), series ())
782+ after = "X"
783+
784+ # Act
785+ instructions , endpoint = _get_instructions_for_insertion (
786+ component , after = after
787+ )
788+
789+ # Assert
790+ assert instructions == []
791+ assert endpoint == "X"
792+
777793 class TestDepGroup :
778794 def test_basic (self ):
779795 # Arrange
You can’t perform that action at this time.
0 commit comments