@@ -100,7 +100,7 @@ def test_strip_comments_preserves_linebreak(self):
100100 sql = 'select * -- a comment\n \n from foo'
101101 res = sqlparse .format (sql , strip_comments = True )
102102 assert res == 'select *\n \n from foo'
103-
103+
104104 def test_strip_comments_preserves_whitespace (self ):
105105 sql = 'SELECT 1/*bar*/ AS foo' # see issue772
106106 res = sqlparse .format (sql , strip_comments = True )
@@ -734,8 +734,8 @@ def test_format_json_ops(): # issue542
734734 "select foo->'bar', foo->'bar';" , reindent = True )
735735 expected = "select foo->'bar',\n foo->'bar';"
736736 assert formatted == expected
737-
738-
737+
738+
739739@pytest .mark .parametrize ('sql, expected_normal, expected_compact' , [
740740 ('case when foo then 1 else bar end' ,
741741 'case\n when foo then 1\n else bar\n end' ,
@@ -745,3 +745,10 @@ def test_compact(sql, expected_normal, expected_compact): # issue783
745745 formatted_compact = sqlparse .format (sql , reindent = True , compact = True )
746746 assert formatted_normal == expected_normal
747747 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