@@ -720,8 +720,8 @@ def test_completion_items(ac_app) -> None:
720
720
line_found = False
721
721
for line in ac_app .formatted_completions .splitlines ():
722
722
# 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 :
725
725
line_found = True
726
726
break
727
727
@@ -743,7 +743,7 @@ def test_completion_items(ac_app) -> None:
743
743
for line in ac_app .formatted_completions .splitlines ():
744
744
# Since the CompletionItems were created from numbers, the left-most column is right-aligned.
745
745
# 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 :
747
747
line_found = True
748
748
break
749
749
@@ -908,7 +908,7 @@ def test_completion_items_arg_header(ac_app) -> None:
908
908
begidx = endidx - len (text )
909
909
910
910
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 ]
912
912
913
913
# Test when metavar is a string
914
914
text = ''
@@ -917,7 +917,7 @@ def test_completion_items_arg_header(ac_app) -> None:
917
917
begidx = endidx - len (text )
918
918
919
919
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 ]
921
921
922
922
# Test when metavar is a tuple
923
923
text = ''
@@ -927,7 +927,7 @@ def test_completion_items_arg_header(ac_app) -> None:
927
927
928
928
# We are completing the first argument of this flag. The first element in the tuple should be the column header.
929
929
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 ]
931
931
932
932
text = ''
933
933
line = f'choices --tuple_metavar token_1 { text } '
@@ -936,7 +936,7 @@ def test_completion_items_arg_header(ac_app) -> None:
936
936
937
937
# We are completing the second argument of this flag. The second element in the tuple should be the column header.
938
938
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 ]
940
940
941
941
text = ''
942
942
line = f'choices --tuple_metavar token_1 token_2 { text } '
@@ -946,7 +946,7 @@ def test_completion_items_arg_header(ac_app) -> None:
946
946
# We are completing the third argument of this flag. It should still be the second tuple element
947
947
# in the column header since the tuple only has two strings in it.
948
948
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 ]
950
950
951
951
952
952
def test_completion_items_descriptive_headers (ac_app ) -> None :
@@ -961,7 +961,7 @@ def test_completion_items_descriptive_headers(ac_app) -> None:
961
961
begidx = endidx - len (text )
962
962
963
963
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 ]
965
965
966
966
# This argument did not provide a descriptive header, so it should be DEFAULT_DESCRIPTIVE_HEADERS
967
967
text = ''
@@ -970,7 +970,7 @@ def test_completion_items_descriptive_headers(ac_app) -> None:
970
970
begidx = endidx - len (text )
971
971
972
972
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 ]
974
974
975
975
976
976
@pytest .mark .parametrize (
0 commit comments