summaryrefslogtreecommitdiff
path: root/tests/test_format.py
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2013-04-05 05:46:41 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2013-04-05 05:46:41 +0200
commit341143e294c842d700dfd3c6a6224c05d8b8b8d6 (patch)
treef58da4333925db8f320ffae40d219a758786a234 /tests/test_format.py
parentbd530692165729051a4caf28934a6e9ad32fbc3e (diff)
downloadsqlparse-341143e294c842d700dfd3c6a6224c05d8b8b8d6.tar.gz
Add order criterion to identifier in ORDER BY clause (fixes #89).
Diffstat (limited to 'tests/test_format.py')
-rw-r--r--tests/test_format.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_format.py b/tests/test_format.py
index c33ac93..17bdc17 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -267,3 +267,14 @@ class TestOutputFormat(TestCaseBase):
sql = 'select * from foo;'
f = lambda sql: sqlparse.format(sql, output_format='sql')
self.ndiffAssertEqual(f(sql), 'select * from foo;')
+
+
+def test_format_column_ordering(): # issue89
+ sql = 'select * from foo order by c1 desc, c2, c3;'
+ formatted = sqlparse.format(sql, reindent=True)
+ expected = '\n'.join(['select *',
+ 'from foo',
+ 'order by c1 desc,',
+ ' c2,',
+ ' c3;'])
+ assert formatted == expected