summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2011-04-13 16:04:56 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2011-04-13 16:04:56 +0200
commit47e7f56a52870bdb278225fc05866efcb5e65a1d (patch)
tree1b35d2b9e25a375cbc256fc406c0d55ac979f120 /tests
parentea2b23a46b4dacf1d76cdbdaa172e25e3b733466 (diff)
downloadsqlparse-47e7f56a52870bdb278225fc05866efcb5e65a1d.tar.gz
Don't group trailing whitepsace in WHERE clauses (fixes issue35).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_regressions.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/test_regressions.py b/tests/test_regressions.py
index 3046b97..cbe1234 100644
--- a/tests/test_regressions.py
+++ b/tests/test_regressions.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-
-import unittest
+from tests.utils import TestCaseBase
import sqlparse
from sqlparse import sql
from sqlparse import tokens as T
-class RegressionTests(unittest.TestCase):
+class RegressionTests(TestCaseBase):
def test_issue9(self):
# make sure where doesn't consume parenthesis
@@ -31,3 +31,11 @@ class RegressionTests(unittest.TestCase):
t = sqlparse.parse("create")[0].token_first()
self.assertEqual(t.match(T.Keyword.DDL, "create"), True)
self.assertEqual(t.match(T.Keyword.DDL, "CREATE"), True)
+
+ def test_issue35(self):
+ # missing space before LIMIT
+ sql = sqlparse.format("select * from foo where bar = 1 limit 1",
+ reindent=True)
+ self.ndiffAssertEqual(sql, "\n".join(["select *",
+ "from foo",
+ "where bar = 1 limit 1"]))