summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraneeshk <aneesh@lyft.com>2015-09-11 19:30:42 -0700
committerVictor Uriarte <victor.m.uriarte@intel.com>2016-06-06 06:31:35 -0700
commit7bc47f0ab6a83aeeb98906b208cfba03c89bd7bd (patch)
tree4178f92586affc109bea8aeccf80525626a0b012
parenta9427d9aff77fd6fcd8ab8d13fc2a87eb16cc2b9 (diff)
downloadsqlparse-7bc47f0ab6a83aeeb98906b208cfba03c89bd7bd.tar.gz
Test: Case statements
-rw-r--r--tests/test_format.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_format.py b/tests/test_format.py
index 2f9ee9f..247c249 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -137,6 +137,34 @@ class TestFormatReindentAligned(TestCaseBase):
" or d is 'blue'",
]))
+ def test_case_statement(self):
+ sql = """
+ select a,
+ case when a = 0
+ then 1
+ when bb = 1 then 1
+ when c = 2 then 2
+ 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',
+ ' else 0',
+ ' end as d,',
+ ' extra_col',
+ ' from table',
+ ' where c is true',
+ ' and b between 3 and 4'
+ ]))
+
class TestFormatReindent(TestCaseBase):