88import pytest
99
1010import mycli .packages .special .main as special
11- from test .utils import pygments_at_least
11+ from test .utils import pygments_below
1212
1313metadata = {
1414 "users" : ["id" , "email" , "first_name" , "last_name" ],
@@ -862,6 +862,7 @@ def test_backticked_column_completion_two_character(completer, complete_event):
862862 Completion (text = '`fixed`' , start_position = - 2 ),
863863 Completion (text = '`float`' , start_position = - 2 ),
864864 Completion (text = '`fetch`' , start_position = - 2 ),
865+ Completion (text = '`files`' , start_position = - 2 ),
865866 Completion (text = '`first`' , start_position = - 2 ),
866867 Completion (text = '`flush`' , start_position = - 2 ),
867868 Completion (text = '`force`' , start_position = - 2 ),
@@ -879,14 +880,19 @@ def test_backticked_column_completion_two_character(completer, complete_event):
879880 Completion (text = '`fulltext`' , start_position = - 2 ),
880881 Completion (text = '`function`' , start_position = - 2 ),
881882 Completion (text = '`from_days`' , start_position = - 2 ),
883+ Completion (text = '`file_name`' , start_position = - 2 ),
882884 Completion (text = '`following`' , start_position = - 2 ),
883885 Completion (text = '`first_name`' , start_position = - 2 ),
884886 Completion (text = '`found_rows`' , start_position = - 2 ),
885887 Completion (text = '`find_in_set`' , start_position = - 2 ),
886888 Completion (text = '`first_value`' , start_position = - 2 ),
887889 Completion (text = '`from_base64`' , start_position = - 2 ),
890+ Completion (text = '`from_vector`' , start_position = - 2 ),
891+ Completion (text = '`file_format`' , start_position = - 2 ),
892+ Completion (text = '`file_prefix`' , start_position = - 2 ),
888893 Completion (text = '`foreign key`' , start_position = - 2 ),
889894 Completion (text = '`format_bytes`' , start_position = - 2 ),
895+ Completion (text = '`file_pattern`' , start_position = - 2 ),
890896 Completion (text = '`from_unixtime`' , start_position = - 2 ),
891897 Completion (text = '`file_block_size`' , start_position = - 2 ),
892898 Completion (text = '`format_pico_time`' , start_position = - 2 ),
@@ -913,17 +919,18 @@ def test_backticked_column_completion_two_character(completer, complete_event):
913919 Completion (text = '`references`' , start_position = - 2 ),
914920 ]
915921
916- if pygments_at_least ("2.20" ):
917- expected . extend ( [
922+ if pygments_below ("2.20" ):
923+ for newer in [
918924 Completion (text = '`file_format`' , start_position = - 2 ),
919925 Completion (text = '`file_name`' , start_position = - 2 ),
920926 Completion (text = '`file_pattern`' , start_position = - 2 ),
921927 Completion (text = '`file_prefix`' , start_position = - 2 ),
922928 Completion (text = '`files`' , start_position = - 2 ),
923929 Completion (text = '`from_vector`' , start_position = - 2 ),
924- ])
930+ ]:
931+ expected .remove (newer )
925932
926- assert sorted (( x . text , x . start_position ) for x in result ) == sorted (( x . text , x . start_position ) for x in expected )
933+ assert result == expected
927934
928935
929936def test_backticked_column_completion_three_character (completer , complete_event ):
@@ -935,13 +942,18 @@ def test_backticked_column_completion_three_character(completer, complete_event)
935942 Completion (text = '`file`' , start_position = - 3 ),
936943 Completion (text = '`field`' , start_position = - 3 ),
937944 Completion (text = '`fixed`' , start_position = - 3 ),
945+ Completion (text = '`files`' , start_position = - 3 ),
938946 Completion (text = '`first`' , start_position = - 3 ),
939947 Completion (text = '`fields`' , start_position = - 3 ),
940948 Completion (text = '`filter`' , start_position = - 3 ),
941949 Completion (text = '`finish`' , start_position = - 3 ),
950+ Completion (text = '`file_name`' , start_position = - 3 ),
942951 Completion (text = '`first_name`' , start_position = - 3 ),
943952 Completion (text = '`find_in_set`' , start_position = - 3 ),
944953 Completion (text = '`first_value`' , start_position = - 3 ),
954+ Completion (text = '`file_format`' , start_position = - 3 ),
955+ Completion (text = '`file_prefix`' , start_position = - 3 ),
956+ Completion (text = '`file_pattern`' , start_position = - 3 ),
945957 Completion (text = '`file_block_size`' , start_position = - 3 ),
946958 Completion (text = '`definer`' , start_position = - 3 ),
947959 Completion (text = '`definition`' , start_position = - 3 ),
@@ -955,16 +967,17 @@ def test_backticked_column_completion_three_character(completer, complete_event)
955967 Completion (text = '`foreign key`' , start_position = - 3 ),
956968 ]
957969
958- if pygments_at_least ("2.20" ):
959- expected . extend ( [
960- Completion (text = '`file_format `' , start_position = - 3 ),
970+ if pygments_below ("2.20" ):
971+ for newer in [
972+ Completion (text = '`files `' , start_position = - 3 ),
961973 Completion (text = '`file_name`' , start_position = - 3 ),
974+ Completion (text = '`file_format`' , start_position = - 3 ),
962975 Completion (text = '`file_pattern`' , start_position = - 3 ),
963976 Completion (text = '`file_prefix`' , start_position = - 3 ),
964- Completion ( text = '`files`' , start_position = - 3 ),
965- ] )
977+ ]:
978+ expected . remove ( newer )
966979
967- assert sorted (( x . text , x . start_position ) for x in result ) == sorted (( x . text , x . start_position ) for x in expected )
980+ assert result == expected
968981
969982
970983def test_backticked_column_completion_four_character (completer , complete_event ):
0 commit comments