summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2017-09-21 10:19:57 +0200
committerGitHub <noreply@github.com>2017-09-21 10:19:57 +0200
commit54551c472bdcb92679872b6bcd8348e5542fd2ee (patch)
tree356e7c7e9c044c2d35335e0813e1d5428babe876 /tests
parent4dd31c48c5ef42ea731e0c6a86b99cb3c89f0a6a (diff)
parent0dd67c791e0a9fdc29cffdc9d84f811fe124726a (diff)
downloadsqlparse-54551c472bdcb92679872b6bcd8348e5542fd2ee.tar.gz
Merge branch 'master' into master
Diffstat (limited to 'tests')
-rw-r--r--tests/test_grouping.py9
-rw-r--r--tests/test_parse.py7
2 files changed, 14 insertions, 2 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 76ba651..1f3a19e 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -216,6 +216,15 @@ def test_grouping_where():
assert isinstance(p.tokens[-1].tokens[0].tokens[-2], sql.Where)
+@pytest.mark.parametrize('s', (
+ 'select 1 where 1 = 2 union select 2',
+ 'select 1 where 1 = 2 union all select 2',
+))
+def test_grouping_where_union(s):
+ p = sqlparse.parse(s)[0]
+ assert p.tokens[5].value.startswith('union')
+
+
def test_returning_kw_ends_where_clause():
s = 'delete from foo where x > y returning z'
p = sqlparse.parse(s)[0]
diff --git a/tests/test_parse.py b/tests/test_parse.py
index 0632889..4ba6ca1 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -135,11 +135,14 @@ def test_quoted_identifier():
assert t[2].get_real_name() == 'y'
-@pytest.mark.parametrize('name', ['foo', '_foo'])
+@pytest.mark.parametrize('name', [
+ 'foo', '_foo', # issue175
+ '1_data', # valid MySQL table name, see issue337
+])
def test_valid_identifier_names(name):
- # issue175
t = sqlparse.parse(name)[0].tokens
assert isinstance(t[0], sql.Identifier)
+ assert t[0].get_name() == name
def test_psql_quotation_marks():