diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py index 568a8d0e..0aa28fb1 100644 --- a/sqlparse/filters/others.py +++ b/sqlparse/filters/others.py @@ -34,7 +34,7 @@ def _get_insert_token(token): sql_hints = (T.Comment.Multiline.Hint, T.Comment.Single.Hint) tidx, token = get_next_comment() while token: - # skipping token remove if token is a SQL hint + # skipping token remove if token is a SQL-Hint. issue262 is_sql_hint = False if token.ttype in sql_hints: is_sql_hint = True diff --git a/tests/test_format.py b/tests/test_format.py index 26cb5edd..2ef3358a 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -68,19 +68,13 @@ def test_strip_comments_single(self): sql = '#+ hint\nselect * from foo' res = sqlparse.format(sql, strip_comments=True) assert res == sql - sql = 'select --+full(u)\n--comment simple' res = sqlparse.format(sql, strip_comments=True) assert res == 'select --+full(u)\n' - sql = '#+ hint\nselect * from foo\n# comment simple' res = sqlparse.format(sql, strip_comments=True) assert res == '#+ hint\nselect * from foo\n' - # sql = '' - # res = sqlparse.format(sql, strip_comments=True) - # assert res == '' - def test_strip_comments_invalid_option(self): sql = 'select-- foo\nfrom -- bar\nwhere' with pytest.raises(SQLParseError): @@ -110,10 +104,6 @@ def test_strip_comments_multi(self): res = sqlparse.format(sql, strip_comments=True) assert res == sql - sql = '' - res = sqlparse.format(sql, strip_comments=True) - assert res == '' - def test_strip_comments_preserves_linebreak(self): sql = 'select * -- a comment\r\nfrom foo' res = sqlparse.format(sql, strip_comments=True)