def test_type_proc(self, sql_proc): name, sql_type, fcn = parse_sql_entry(sql_proc) assert sql_type == QueryType.CALL_PROC
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
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
def test_type_built(self, sql_built): name, sql_type, fcn = parse_sql_entry(sql_built) assert sql_type == QueryType.SELECT_BUILT
def test_type_bang(self, sql_bang): name, sql_type, fcn = parse_sql_entry(sql_bang) assert sql_type == QueryType.INSERT_UPDATE_DELETE
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)
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)
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)
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)