diff options
| author | Adam Greenhall <agreenhall@lyft.com> | 2015-09-12 01:52:01 -0700 |
|---|---|---|
| committer | Victor Uriarte <victor.m.uriarte@intel.com> | 2016-06-06 06:31:35 -0700 |
| commit | 74faef72d8e136a37bec93cc688817c97d162482 (patch) | |
| tree | b2cd48e9ff194d5b7d2b74e52a22e3e2021e8d97 /tests | |
| parent | b15c9c60e2479f6397b7bbcb0787ee66c499e7f8 (diff) | |
| download | sqlparse-74faef72d8e136a37bec93cc688817c97d162482.tar.gz | |
Fix Case statements Alignment
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_format.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_format.py b/tests/test_format.py index dccc3ec..8151bb4 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -193,6 +193,36 @@ class TestFormatReindentAligned(TestCaseBase): ' and b between 3 and 4' ])) + def test_case_statement_with_between(self): + sql = """ + select a, + case when a = 0 + then 1 + when bb = 1 then 1 + when c = 2 then 2 + when d between 3 and 5 then 3 + else 0 end as d, + extra_col + from table + where c is true + and b between 3 and 4 + """ + self.ndiffAssertEqual( + self.formatter(sql), + '\n'.join([ + 'select a,', + ' case when a = 0 then 1', + ' when bb = 1 then 1', + ' when c = 2 then 2', + ' when d between 3 and 5 then 3', + ' else 0', + ' end as d,', + ' extra_col', + ' from table', + ' where c is true', + ' and b between 3 and 4' + ])) + def test_group_by(self): sql = """ select a, b, c, sum(x) as sum_x, count(y) as cnt_y |
