@@ -100,7 +100,7 @@ def test_strip_comments_preserves_linebreak(self):
100
100
sql = 'select * -- a comment\n \n from foo'
101
101
res = sqlparse .format (sql , strip_comments = True )
102
102
assert res == 'select *\n \n from foo'
103
-
103
+
104
104
def test_strip_comments_preserves_whitespace (self ):
105
105
sql = 'SELECT 1/*bar*/ AS foo' # see issue772
106
106
res = sqlparse .format (sql , strip_comments = True )
@@ -734,8 +734,8 @@ def test_format_json_ops(): # issue542
734
734
"select foo->'bar', foo->'bar';" , reindent = True )
735
735
expected = "select foo->'bar',\n foo->'bar';"
736
736
assert formatted == expected
737
-
738
-
737
+
738
+
739
739
@pytest .mark .parametrize ('sql, expected_normal, expected_compact' , [
740
740
('case when foo then 1 else bar end' ,
741
741
'case\n when foo then 1\n else bar\n end' ,
@@ -745,3 +745,10 @@ def test_compact(sql, expected_normal, expected_compact): # issue783
745
745
formatted_compact = sqlparse .format (sql , reindent = True , compact = True )
746
746
assert formatted_normal == expected_normal
747
747
assert formatted_compact == expected_compact
748
+
749
+
750
+ def test_strip_ws_removes_trailing_ws_in_groups (): # issue782
751
+ formatted = sqlparse .format ('( where foo = bar ) from' ,
752
+ strip_whitespace = True )
753
+ expected = '(where foo = bar) from'
754
+ assert formatted == expected
0 commit comments