diff options
| author | Corey Zumar <corey.zumar@databricks.com> | 2019-12-25 00:22:02 -0800 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2020-01-16 09:19:34 +0100 |
| commit | 101084b790496ae916557f6407be18c4e528f776 (patch) | |
| tree | 3385dbee40c38d1019f98e1f71c571199b7e3d1f /tests | |
| parent | 6f72de13a3db480ed2909965b6e8cd02ac7fdf7e (diff) | |
| download | sqlparse-101084b790496ae916557f6407be18c4e528f776.tar.gz | |
More test cases
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_grouping.py | 4 | ||||
| -rw-r--r-- | tests/test_tokenize.py | 19 |
2 files changed, 22 insertions, 1 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py index 5828e08..3e9b1bd 100644 --- a/tests/test_grouping.py +++ b/tests/test_grouping.py @@ -472,7 +472,9 @@ def test_comparison_with_parenthesis(): assert comp.right.ttype is T.Number.Integer -@pytest.mark.parametrize('operator', ['LIKE', 'NOT LIKE', 'ILIKE', 'NOT ILIKE']) +@pytest.mark.parametrize('operator', ( + 'LIKE', 'NOT LIKE', 'ILIKE', 'NOT ILIKE', +)) def test_comparison_with_strings(operator): # issue148 p = sqlparse.parse("foo {0} 'bar'".format(operator))[0] diff --git a/tests/test_tokenize.py b/tests/test_tokenize.py index 2748b1b..1b34342 100644 --- a/tests/test_tokenize.py +++ b/tests/test_tokenize.py @@ -205,6 +205,25 @@ def test_parse_order_by(): @pytest.mark.parametrize('s', ( + "LIKE", "ILIKE", "NOT LIKE", "NOT ILIKE", + "NOT LIKE", "NOT ILIKE", +)) +def test_like_and_ilike_parsed_as_comparisons(s): + p = sqlparse.parse(s)[0] + assert len(p.tokens) == 1 + assert p.tokens[0].ttype == T.Operator.Comparison + + +@pytest.mark.parametrize('s', ( + "LIKEaaa", "bILIKE", "aaILIKEbb", "NOTLIKE", "NOTILIKE", +)) +def test_near_like_and_ilike_parsed_appropriately(s): + p = sqlparse.parse(s)[0] + assert len(p.tokens) == 1 + assert isinstance(p.tokens[0], sql.Identifier) + + +@pytest.mark.parametrize('s', ( 'AT TIME ZONE \'UTC\'', )) def test_parse_tzcast(s): |
