from pgcli.packages.sqlcompletion import suggest_type


def test_select_suggests_cols_with_table_scope():
    suggestion = suggest_type('SELECT  FROM tabl', 'SELECT ')
    assert suggestion == ('columns-and-functions', ['tabl'])

def test_lparen_suggest_cols():
    suggestion = suggest_type('SELECT MAX( FROM tbl', 'SELECT MAX(')
    assert suggestion == ('columns', ['tbl'])

def test_select_suggest_cols_and_funcs():
    suggestion = suggest_type('SELECT ', 'SELECT ')
    assert suggestion == ('columns-and-functions', [])

def test_from_suggest_tables():
    suggestion = suggest_type('SELECT * FROM ', 'SELECT * FROM ')
    assert suggestion == ('tables', [])

def test_distinct_suggest_cols():
    suggestion = suggest_type('SELECT DISTINCT ', 'SELECT DISTINCT ')
    assert suggestion == ('columns', [])

def test_multiple_cols_suggest_cols():
    suggestion = suggest_type('SELECT a, b, FROM tbl', 'SELECT a, b,')
    assert suggestion == ('columns-and-functions', ['tbl'])

def test_multiple_tables_suggest_tables():
    suggestion = suggest_type('SELECT a, b FROM tbl1, ',
            'SELECT a, b FROM tbl1, ')
    assert suggestion == ('tables', [])

from pgcli.packages.sqlcompletion import suggest_type


def test_select_suggests_cols_with_table_scope():
    suggestion = suggest_type('SELECT  FROM tabl', 'SELECT ')
    assert suggestion == ('columns-and-functions', ['tabl'])

def test_where_suggests_columns_functions():
    suggestion = suggest_type('SELECT * FROM tabl WHERE ',
            'SELECT * FROM tabl WHERE ')
    assert suggestion == ('columns-and-functions', ['tabl'])

def test_lparen_suggests_cols():
    suggestion = suggest_type('SELECT MAX( FROM tbl', 'SELECT MAX(')
    assert suggestion == ('columns', ['tbl'])

def test_select_suggests_cols_and_funcs():
    suggestion = suggest_type('SELECT ', 'SELECT ')
    assert suggestion == ('columns-and-functions', [])

def test_from_suggests_tables():
    suggestion = suggest_type('SELECT * FROM ', 'SELECT * FROM ')
    assert suggestion == ('tables', [])

def test_distinct_suggests_cols():
    suggestion = suggest_type('SELECT DISTINCT ', 'SELECT DISTINCT ')
    assert suggestion == ('columns', [])

def test_col_comma_suggests_cols():
    suggestion = suggest_type('SELECT a, b, FROM tbl', 'SELECT a, b,')
    assert suggestion == ('columns-and-functions', ['tbl'])

def test_table_comma_suggests_tables():
    suggestion = suggest_type('SELECT a, b FROM tbl1, ',
            'SELECT a, b FROM tbl1, ')
    assert suggestion == ('tables', [])

def test_into_suggests_tables():
    suggestion = suggest_type('INSERT INTO ',
            'INSERT INTO ')
    assert suggestion == ('tables', [])

Add a test for where clause and rename all tests functions.
Add a test for where clause and rename all tests functions.

  from pgcli.packages.sqlcompletion import suggest_type
  
  
  def test_select_suggests_cols_with_table_scope():
      suggestion = suggest_type('SELECT  FROM tabl', 'SELECT ')
      assert suggestion == ('columns-and-functions', ['tabl'])
  
+ def test_where_suggests_columns_functions():
+     suggestion = suggest_type('SELECT * FROM tabl WHERE ',
+             'SELECT * FROM tabl WHERE ')
+     assert suggestion == ('columns-and-functions', ['tabl'])
+ 
- def test_lparen_suggest_cols():
+ def test_lparen_suggests_cols():
      suggestion = suggest_type('SELECT MAX( FROM tbl', 'SELECT MAX(')
      assert suggestion == ('columns', ['tbl'])
  
- def test_select_suggest_cols_and_funcs():
+ def test_select_suggests_cols_and_funcs():
      suggestion = suggest_type('SELECT ', 'SELECT ')
      assert suggestion == ('columns-and-functions', [])
  
- def test_from_suggest_tables():
+ def test_from_suggests_tables():
      suggestion = suggest_type('SELECT * FROM ', 'SELECT * FROM ')
      assert suggestion == ('tables', [])
  
- def test_distinct_suggest_cols():
+ def test_distinct_suggests_cols():
      suggestion = suggest_type('SELECT DISTINCT ', 'SELECT DISTINCT ')
      assert suggestion == ('columns', [])
  
- def test_multiple_cols_suggest_cols():
+ def test_col_comma_suggests_cols():
      suggestion = suggest_type('SELECT a, b, FROM tbl', 'SELECT a, b,')
      assert suggestion == ('columns-and-functions', ['tbl'])
  
- def test_multiple_tables_suggest_tables():
+ def test_table_comma_suggests_tables():
      suggestion = suggest_type('SELECT a, b FROM tbl1, ',
              'SELECT a, b FROM tbl1, ')
      assert suggestion == ('tables', [])
  
+ def test_into_suggests_tables():
+     suggestion = suggest_type('INSERT INTO ',
+             'INSERT INTO ')
+     assert suggestion == ('tables', [])
+ 
Add a test for where clause and rename all tests functions.
## Code Before:
from pgcli.packages.sqlcompletion import suggest_type


def test_select_suggests_cols_with_table_scope():
    suggestion = suggest_type('SELECT  FROM tabl', 'SELECT ')
    assert suggestion == ('columns-and-functions', ['tabl'])

def test_lparen_suggest_cols():
    suggestion = suggest_type('SELECT MAX( FROM tbl', 'SELECT MAX(')
    assert suggestion == ('columns', ['tbl'])

def test_select_suggest_cols_and_funcs():
    suggestion = suggest_type('SELECT ', 'SELECT ')
    assert suggestion == ('columns-and-functions', [])

def test_from_suggest_tables():
    suggestion = suggest_type('SELECT * FROM ', 'SELECT * FROM ')
    assert suggestion == ('tables', [])

def test_distinct_suggest_cols():
    suggestion = suggest_type('SELECT DISTINCT ', 'SELECT DISTINCT ')
    assert suggestion == ('columns', [])

def test_multiple_cols_suggest_cols():
    suggestion = suggest_type('SELECT a, b, FROM tbl', 'SELECT a, b,')
    assert suggestion == ('columns-and-functions', ['tbl'])

def test_multiple_tables_suggest_tables():
    suggestion = suggest_type('SELECT a, b FROM tbl1, ',
            'SELECT a, b FROM tbl1, ')
    assert suggestion == ('tables', [])

## Instruction:
Add a test for where clause and rename all tests functions.
## Code After:
from pgcli.packages.sqlcompletion import suggest_type


def test_select_suggests_cols_with_table_scope():
    suggestion = suggest_type('SELECT  FROM tabl', 'SELECT ')
    assert suggestion == ('columns-and-functions', ['tabl'])

def test_where_suggests_columns_functions():
    suggestion = suggest_type('SELECT * FROM tabl WHERE ',
            'SELECT * FROM tabl WHERE ')
    assert suggestion == ('columns-and-functions', ['tabl'])

def test_lparen_suggests_cols():
    suggestion = suggest_type('SELECT MAX( FROM tbl', 'SELECT MAX(')
    assert suggestion == ('columns', ['tbl'])

def test_select_suggests_cols_and_funcs():
    suggestion = suggest_type('SELECT ', 'SELECT ')
    assert suggestion == ('columns-and-functions', [])

def test_from_suggests_tables():
    suggestion = suggest_type('SELECT * FROM ', 'SELECT * FROM ')
    assert suggestion == ('tables', [])

def test_distinct_suggests_cols():
    suggestion = suggest_type('SELECT DISTINCT ', 'SELECT DISTINCT ')
    assert suggestion == ('columns', [])

def test_col_comma_suggests_cols():
    suggestion = suggest_type('SELECT a, b, FROM tbl', 'SELECT a, b,')
    assert suggestion == ('columns-and-functions', ['tbl'])

def test_table_comma_suggests_tables():
    suggestion = suggest_type('SELECT a, b FROM tbl1, ',
            'SELECT a, b FROM tbl1, ')
    assert suggestion == ('tables', [])

def test_into_suggests_tables():
    suggestion = suggest_type('INSERT INTO ',
            'INSERT INTO ')
    assert suggestion == ('tables', [])
