summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDennis Taylor <dennis.taylor@clio.com>2016-06-02 15:28:27 -0700
committerDennis Taylor <dennis.taylor@clio.com>2016-06-02 15:28:27 -0700
commit9b84aac37a4099f4788508f98b7b1ed3010c424e (patch)
tree44c100cccbc104d1598cedc9c20baa664cb1abd7 /tests
parenta767c88b008d407d91b9118d124e2a9b579a7f12 (diff)
downloadsqlparse-9b84aac37a4099f4788508f98b7b1ed3010c424e.tar.gz
Add --wrap_after option for wrapping identifier lists.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_format.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_format.py b/tests/test_format.py
index e8875dd..9043e76 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -117,6 +117,10 @@ class TestFormatReindent(TestCaseBase):
reindent=True, indent_width='foo')
self.assertRaises(SQLParseError, sqlparse.format, 'foo',
reindent=True, indent_width=-12)
+ self.assertRaises(SQLParseError, sqlparse.format, 'foo',
+ reindent=True, wrap_after='foo')
+ self.assertRaises(SQLParseError, sqlparse.format, 'foo',
+ reindent=True, wrap_after=-12)
def test_stmts(self):
f = lambda sql: sqlparse.format(sql, reindent=True)
@@ -204,6 +208,14 @@ class TestFormatReindent(TestCaseBase):
'from a,',
' b']))
+ def test_identifier_list_with_wrap_after(self):
+ f = lambda sql: sqlparse.format(sql, reindent=True, wrap_after=14)
+ s = 'select foo, bar, baz from table1, table2 where 1 = 2'
+ self.ndiffAssertEqual(f(s), '\n'.join(['select foo, bar,',
+ ' baz',
+ 'from table1, table2',
+ 'where 1 = 2']))
+
def test_identifier_list_with_functions(self):
f = lambda sql: sqlparse.format(sql, reindent=True)
s = ("select 'abc' as foo, coalesce(col1, col2)||col3 as bar,"