From dff274ca46e8a38b2f1615b99a799e3266dc8c5e Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Tue, 18 Apr 2017 08:50:50 +0200 Subject: Re-order parsing so that comparisons are seens as identifiers (fixes #327). --- tests/test_grouping.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/test_grouping.py b/tests/test_grouping.py index 72f94f6..76ba651 100644 --- a/tests/test_grouping.py +++ b/tests/test_grouping.py @@ -64,6 +64,20 @@ def test_grouping_identifiers(): assert identifiers[0].get_alias() == "col" +@pytest.mark.parametrize('s', [ + '1 as f', + 'foo as f', + 'foo f', + '1/2 as f', + '1/2 f', + '1<2 as f', # issue327 + '1<2 f', +]) +def test_simple_identifiers(s): + parsed = sqlparse.parse(s)[0] + assert isinstance(parsed.tokens[0], sql.Identifier) + + @pytest.mark.parametrize('s', [ 'foo, bar', 'sum(a), sum(b)', -- cgit v1.2.1