Exemple #1
0
 def test_type_proc(self, sql_proc):
     name, sql_type, fcn = parse_sql_entry(sql_proc)
     assert sql_type == QueryType.CALL_PROC
Exemple #2
0
 def test_select_1(self, db_cur, sql_select_1):
     name, sql_type, fcn = parse_sql_entry(sql_select_1)
     output = fcn(db_cur, n=1)
     assert output[0] == 1
Exemple #3
0
 def test_type_bang_return(self, sql_bang_return):
     name, sql_type, fcn = parse_sql_entry(sql_bang_return)
     assert sql_type == QueryType.RETURN_ID
Exemple #4
0
 def test_type_built(self, sql_built):
     name, sql_type, fcn = parse_sql_entry(sql_built)
     assert sql_type == QueryType.SELECT_BUILT
Exemple #5
0
 def test_type_bang(self, sql_bang):
     name, sql_type, fcn = parse_sql_entry(sql_bang)
     assert sql_type == QueryType.INSERT_UPDATE_DELETE
Exemple #6
0
 def test_parse_exception4(self, invalid_sql_built_args):
     exc_msg = r'^parse error, arg numbers do not match in string s: .*'
     with pytest.raises(SQLParseException, match=exc_msg):
         parse_sql_entry(invalid_sql_built_args)
Exemple #7
0
 def test_parse_exception3(self, invalid_sql_built):
     exc_msg = r'^parse error, no argument found between \(\.\.\.\): .*'
     with pytest.raises(SQLParseException, match=exc_msg):
         parse_sql_entry(invalid_sql_built)
Exemple #8
0
 def test_parse_exception2(self, invalid_sql_name_spaces):
     exc_msg = r'^Query name has spaces: .*'
     with pytest.raises(SQLParseException, match=exc_msg):
         parse_sql_entry(invalid_sql_name_spaces)
Exemple #9
0
 def test_parse_exception(self, invalid_sql_name_start):
     exc_msg = r'^Query does not start with "-- name:": .*'
     with pytest.raises(SQLParseException, match=exc_msg):
         parse_sql_entry(invalid_sql_name_start)