summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2020-09-13 13:29:36 +0200
committerAndi Albrecht <albrecht.andi@gmail.com>2020-09-13 13:29:36 +0200
commit1499cffcd7c4d635b4297b44d48fb4fe94cf988e (patch)
tree78e668b8887fe5f108630cb83f19d16e7d4c7ace /tests
parentca6d149e0a8d2dfd95a44f859c891122983943ff (diff)
downloadsqlparse-1499cffcd7c4d635b4297b44d48fb4fe94cf988e.tar.gz
Preserve line breaks when removing comments (fixes #484).
Diffstat (limited to 'tests')
-rw-r--r--tests/test_format.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test_format.py b/tests/test_format.py
index 20390ff..7117d9d 100644
--- a/tests/test_format.py
+++ b/tests/test_format.py
@@ -41,26 +41,26 @@ class TestFormat:
def test_strip_comments_single(self):
sql = 'select *-- statement starts here\nfrom foo'
res = sqlparse.format(sql, strip_comments=True)
- assert res == 'select * from foo'
+ assert res == 'select *\nfrom foo'
sql = 'select * -- statement starts here\nfrom foo'
res = sqlparse.format(sql, strip_comments=True)
- assert res == 'select * from foo'
+ assert res == 'select *\nfrom foo'
sql = 'select-- foo\nfrom -- bar\nwhere'
res = sqlparse.format(sql, strip_comments=True)
- assert res == 'select from where'
+ assert res == 'select\nfrom\nwhere'
sql = 'select *-- statement starts here\n\nfrom foo'
res = sqlparse.format(sql, strip_comments=True)
- assert res == 'select * from foo'
+ assert res == 'select *\n\nfrom foo'
sql = 'select * from foo-- statement starts here\nwhere'
res = sqlparse.format(sql, strip_comments=True)
- assert res == 'select * from foo where'
+ assert res == 'select * from foo\nwhere'
sql = 'select a-- statement starts here\nfrom foo'
res = sqlparse.format(sql, strip_comments=True)
- assert res == 'select a from foo'
+ assert res == 'select a\nfrom foo'
sql = '--comment\nselect a-- statement starts here\n' \
'from foo--comment\nf'
res = sqlparse.format(sql, strip_comments=True)
- assert res == 'select a from foo f'
+ assert res == 'select a\nfrom foo\nf'
def test_strip_comments_invalid_option(self):
sql = 'select-- foo\nfrom -- bar\nwhere'