summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdam Greenhall <agreenhall@lyft.com>2015-09-11 16:51:06 -0700
committerVictor Uriarte <victor.m.uriarte@intel.com>2016-06-06 06:31:35 -0700
commita9427d9aff77fd6fcd8ab8d13fc2a87eb16cc2b9 (patch)
treeabe7af31276061bd8da27bc077a3a1950a516f6b /tests
parentb9d81ac4fe49114f57dc33c0d635f99ff56e62f2 (diff)
downloadsqlparse-a9427d9aff77fd6fcd8ab8d13fc2a87eb16cc2b9.tar.gz
Start work on Aligned-reindent
Diffstat (limited to 'tests')
-rw-r--r--tests/test_format.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_format.py b/tests/test_format.py
index 9043e76..2f9ee9f 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -106,6 +106,38 @@ class TestFormat(TestCaseBase):
output_format='foo')
+class TestFormatReindentAligned(TestCaseBase):
+ @staticmethod
+ def formatter(sql):
+ return sqlparse.format(sql, reindent_aligned=True)
+
+ def test_basic(self):
+ sql = """
+ select a, b as bb,c from table
+ join (select a * 2 as a from new_table) other
+ on table.a = other.a
+ where c is true
+ and b between 3 and 4
+ or d is 'blue'
+ """
+ self.ndiffAssertEqual(
+ self.formatter(sql),
+ '\n'.join([
+ 'select a,',
+ ' b as bb,',
+ ' c',
+ ' from table',
+ ' join (',
+ ' select a * 2 as a',
+ ' from new_table',
+ ' ) other',
+ ' on table.a = other.a',
+ ' where c is true',
+ ' and b between 3 and 4',
+ " or d is 'blue'",
+ ]))
+
+
class TestFormatReindent(TestCaseBase):
def test_option(self):