#NEWLINE# def test_learn_table_names( completer , complete_event ) : #NEWLINE# #INDENT# history = 'SELECT * FROM users; SELECT * FROM orders; SELECT * FROM users' #NEWLINE# completer . extend_query_history ( history ) #NEWLINE# sql = 'SELECT * FROM ' #NEWLINE# completions = completer . get_completions ( Document ( text = sql , cursor_position = len ( sql ) ) , complete_event ) #NEWLINE# users = Completion ( text = 'users' , start_position = 0 , display_meta = 'table' ) #NEWLINE# orders = Completion ( text = 'orders' , start_position = 0 , display_meta = 'table' ) #NEWLINE# assert ( completions . index ( users ) < completions . index ( orders ) )