summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2014-10-29 08:35:58 +0100
committerAndi Albrecht <albrecht.andi@gmail.com>2014-10-29 08:35:58 +0100
commit0619bb662fb102eabb78f7059270d5766812c1e1 (patch)
treece916f90636572ff36d8097c4970405371d4c559 /tests
parent991e7348075accae6d08025212251af21e92e664 (diff)
downloadsqlparse-0619bb662fb102eabb78f7059270d5766812c1e1.tar.gz
Handle single quoted strings in comparisons correctly (fixes issue148).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_grouping.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_grouping.py b/tests/test_grouping.py
index 38c1f66..93f1b0e 100644
--- a/tests/test_grouping.py
+++ b/tests/test_grouping.py
@@ -287,6 +287,14 @@ def test_comparison_with_parenthesis(): # issue23
assert comp.right.ttype is T.Number.Integer
+def test_comparison_with_strings(): # issue148
+ p = sqlparse.parse('foo = \'bar\'')[0]
+ assert len(p.tokens) == 1
+ assert isinstance(p.tokens[0], sql.Comparison)
+ assert p.tokens[0].right.value == '\'bar\''
+ assert p.tokens[0].right.ttype == T.String.Single
+
+
@pytest.mark.parametrize('start', ['FOR', 'FOREACH'])
def test_forloops(start):
p = sqlparse.parse('%s foo in bar LOOP foobar END LOOP' % start)[0]