From c08c750e799af5c17ccbebf9b34b95a38f8cfb55 Mon Sep 17 00:00:00 2001 From: Andi Albrecht Date: Thu, 24 Oct 2013 08:38:21 +0200 Subject: Improve grouping of expressions (targets #23). --- tests/test_grouping.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/test_grouping.py') diff --git a/tests/test_grouping.py b/tests/test_grouping.py index fe6aa7d..f4bfb1a 100644 --- a/tests/test_grouping.py +++ b/tests/test_grouping.py @@ -262,9 +262,18 @@ def test_comparison_with_keywords(): # issue90 assert len(p.tokens) == 1 assert isinstance(p.tokens[0], sql.Comparison) assert len(p.tokens[0].tokens) == 5 - assert p.tokens[0].tokens[0].value == 'foo' - assert p.tokens[0].tokens[-1].value == 'NULL' + assert p.tokens[0].left.value == 'foo' + assert p.tokens[0].right.value == 'NULL' # make sure it's case-insensitive p = sqlparse.parse('foo = null')[0] assert len(p.tokens) == 1 assert isinstance(p.tokens[0], sql.Comparison) + + +def test_comparison_with_parenthesis(): # issue23 + p = sqlparse.parse('(3 + 4) = 7')[0] + assert len(p.tokens) == 1 + assert isinstance(p.tokens[0], sql.Comparison) + comp = p.tokens[0] + assert isinstance(comp.left, sql.Parenthesis) + assert comp.right.ttype is T.Number.Integer -- cgit v1.2.1