Skip to content

Commit

Permalink
Add tests for exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
surister committed Jun 3, 2024
1 parent c1b749d commit 122b80f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 80 deletions.
75 changes: 0 additions & 75 deletions cratedb_sqlparse_py/tests/test_exceptions.py

This file was deleted.

17 changes: 12 additions & 5 deletions cratedb_sqlparse_py/tests/test_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ def test_sqlparse_dollar_string():
assert r[0].query == query


def test_sqlparse_raises_exception():
from cratedb_sqlparse import ParsingException, sqlparse
def test_sqlparse_multiquery_edge_case():
# Test for https://github.com/crate/cratedb-sqlparse/issues/28,
# if this ends up parsing 3 statements, we can change this test,
# it's here so we can programmatically track if the behavior changes.
from cratedb_sqlparse import sqlparse

query = "SALUT MON AMIE"
query = """
SELECT A FROM tbl1 where ;
SELEC 1;
SELECT D, A FROM tbl1 WHERE;
"""

with pytest.raises(ParsingException):
sqlparse(query)
statements = sqlparse(query)
assert len(statements) == 1


def test_sqlparse_is_case_insensitive():
Expand Down

0 comments on commit 122b80f

Please sign in to comment.