summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2013-10-24 08:38:21 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2013-10-24 08:38:21 +0200
commitc08c750e799af5c17ccbebf9b34b95a38f8cfb55 (patch)
tree96597aa0afe0b0714b6dc9411613e8fa2de8bda0 /tests
parente3d32fadd637b53863d8c43593c39707a777c897 (diff)
downloadsqlparse-c08c750e799af5c17ccbebf9b34b95a38f8cfb55.tar.gz
Improve grouping of expressions (targets #23).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_grouping.py13
1 files changed, 11 insertions, 2 deletions
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