@@ -720,8 +720,8 @@ def test_completion_items(ac_app) -> None:
720720 line_found = False
721721 for line in ac_app .formatted_completions .splitlines ():
722722 # Since the CompletionItems were created from strings, the left-most column is left-aligned.
723- # Therefore choice_1 will begin the line (with 1 space for padding).
724- if line .startswith (' choice_1' ) and 'A description' in line :
723+ # Therefore choice_1 will begin the line (with 2 spaces for padding).
724+ if line .startswith (' choice_1' ) and 'A description' in line :
725725 line_found = True
726726 break
727727
@@ -743,7 +743,7 @@ def test_completion_items(ac_app) -> None:
743743 for line in ac_app .formatted_completions .splitlines ():
744744 # Since the CompletionItems were created from numbers, the left-most column is right-aligned.
745745 # Therefore 1.5 will be right-aligned.
746- if line .startswith (" 1.5" ) and "One.Five" in line :
746+ if line .startswith (" 1.5" ) and "One.Five" in line :
747747 line_found = True
748748 break
749749
@@ -908,7 +908,7 @@ def test_completion_items_arg_header(ac_app) -> None:
908908 begidx = endidx - len (text )
909909
910910 complete_tester (text , line , begidx , endidx , ac_app )
911- assert "DESC_HEADER" in normalize (ac_app .formatted_completions )[0 ]
911+ assert "DESC_HEADER" in normalize (ac_app .formatted_completions )[1 ]
912912
913913 # Test when metavar is a string
914914 text = ''
@@ -917,7 +917,7 @@ def test_completion_items_arg_header(ac_app) -> None:
917917 begidx = endidx - len (text )
918918
919919 complete_tester (text , line , begidx , endidx , ac_app )
920- assert ac_app .STR_METAVAR in normalize (ac_app .formatted_completions )[0 ]
920+ assert ac_app .STR_METAVAR in normalize (ac_app .formatted_completions )[1 ]
921921
922922 # Test when metavar is a tuple
923923 text = ''
@@ -927,7 +927,7 @@ def test_completion_items_arg_header(ac_app) -> None:
927927
928928 # We are completing the first argument of this flag. The first element in the tuple should be the column header.
929929 complete_tester (text , line , begidx , endidx , ac_app )
930- assert ac_app .TUPLE_METAVAR [0 ].upper () in normalize (ac_app .formatted_completions )[0 ]
930+ assert ac_app .TUPLE_METAVAR [0 ].upper () in normalize (ac_app .formatted_completions )[1 ]
931931
932932 text = ''
933933 line = f'choices --tuple_metavar token_1 { text } '
@@ -936,7 +936,7 @@ def test_completion_items_arg_header(ac_app) -> None:
936936
937937 # We are completing the second argument of this flag. The second element in the tuple should be the column header.
938938 complete_tester (text , line , begidx , endidx , ac_app )
939- assert ac_app .TUPLE_METAVAR [1 ].upper () in normalize (ac_app .formatted_completions )[0 ]
939+ assert ac_app .TUPLE_METAVAR [1 ].upper () in normalize (ac_app .formatted_completions )[1 ]
940940
941941 text = ''
942942 line = f'choices --tuple_metavar token_1 token_2 { text } '
@@ -946,7 +946,7 @@ def test_completion_items_arg_header(ac_app) -> None:
946946 # We are completing the third argument of this flag. It should still be the second tuple element
947947 # in the column header since the tuple only has two strings in it.
948948 complete_tester (text , line , begidx , endidx , ac_app )
949- assert ac_app .TUPLE_METAVAR [1 ].upper () in normalize (ac_app .formatted_completions )[0 ]
949+ assert ac_app .TUPLE_METAVAR [1 ].upper () in normalize (ac_app .formatted_completions )[1 ]
950950
951951
952952def test_completion_items_descriptive_headers (ac_app ) -> None :
@@ -961,7 +961,7 @@ def test_completion_items_descriptive_headers(ac_app) -> None:
961961 begidx = endidx - len (text )
962962
963963 complete_tester (text , line , begidx , endidx , ac_app )
964- assert ac_app .CUSTOM_DESC_HEADERS [0 ] in normalize (ac_app .formatted_completions )[0 ]
964+ assert ac_app .CUSTOM_DESC_HEADERS [0 ] in normalize (ac_app .formatted_completions )[1 ]
965965
966966 # This argument did not provide a descriptive header, so it should be DEFAULT_DESCRIPTIVE_HEADERS
967967 text = ''
@@ -970,7 +970,7 @@ def test_completion_items_descriptive_headers(ac_app) -> None:
970970 begidx = endidx - len (text )
971971
972972 complete_tester (text , line , begidx , endidx , ac_app )
973- assert DEFAULT_DESCRIPTIVE_HEADERS [0 ] in normalize (ac_app .formatted_completions )[0 ]
973+ assert DEFAULT_DESCRIPTIVE_HEADERS [0 ] in normalize (ac_app .formatted_completions )[1 ]
974974
975975
976976@pytest .mark .parametrize (
0 commit comments