Skip to content

Commit 8eb778c

Browse files
skryzhandialbrecht
authored andcommitted
[fix] issue262 adding comment and tests
1 parent af6df6c commit 8eb778c

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

sqlparse/filters/others.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _get_insert_token(token):
3434
sql_hints = (T.Comment.Multiline.Hint, T.Comment.Single.Hint)
3535
tidx, token = get_next_comment()
3636
while token:
37-
# skipping token remove if token is a SQL hint
37+
# skipping token remove if token is a SQL-Hint. issue262
3838
is_sql_hint = False
3939
if token.ttype in sql_hints:
4040
is_sql_hint = True

tests/test_format.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,13 @@ def test_strip_comments_single(self):
6868
sql = '#+ hint\nselect * from foo'
6969
res = sqlparse.format(sql, strip_comments=True)
7070
assert res == sql
71-
7271
sql = 'select --+full(u)\n--comment simple'
7372
res = sqlparse.format(sql, strip_comments=True)
7473
assert res == 'select --+full(u)\n'
75-
7674
sql = '#+ hint\nselect * from foo\n# comment simple'
7775
res = sqlparse.format(sql, strip_comments=True)
7876
assert res == '#+ hint\nselect * from foo\n'
7977

80-
# sql = ''
81-
# res = sqlparse.format(sql, strip_comments=True)
82-
# assert res == ''
83-
8478
def test_strip_comments_invalid_option(self):
8579
sql = 'select-- foo\nfrom -- bar\nwhere'
8680
with pytest.raises(SQLParseError):
@@ -110,10 +104,6 @@ def test_strip_comments_multi(self):
110104
res = sqlparse.format(sql, strip_comments=True)
111105
assert res == sql
112106

113-
sql = ''
114-
res = sqlparse.format(sql, strip_comments=True)
115-
assert res == ''
116-
117107
def test_strip_comments_preserves_linebreak(self):
118108
sql = 'select * -- a comment\r\nfrom foo'
119109
res = sqlparse.format(sql, strip_comments=True)

0 commit comments

Comments
 (0)