Skip to content

Commit 9d87002

Browse files
committed
Fix test_execute_commented_first_line_and_special assertions
With strip_comments=True, trailing comments after \h are correctly removed, so \h now shows full help output instead of "No help". The original test expectations were based on a sqlparse bug where comments were kept as arguments — the upstream TODO comments acknowledged this was undesired behavior.
1 parent 693e281 commit 9d87002

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

tests/test_pgexecute.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -384,24 +384,23 @@ def test_execute_commented_first_line_and_special(executor, pgspecial, tmpdir):
384384
assert result[1].find("ALTER") >= 0
385385
assert result[1].find("ABORT") >= 0
386386

387+
# With strip_comments=True, trailing comments are removed and \h shows
388+
# full help output (previously sqlparse left comments as arguments,
389+
# causing "No help" — that was a bug, not intended behavior)
387390
statement = """\\h /*comment4 */"""
388391
result = run(executor, statement, pgspecial=pgspecial)
389-
print(result)
390392
assert result is not None
391-
assert result[0].find("No help") >= 0
392-
393-
# TODO: we probably don't want to do this but sqlparse is not parsing things well
394-
# we relly want it to find help but right now, sqlparse isn't dropping the /*comment*/
395-
# style comments after command
393+
assert result[1].find("ALTER") >= 0
394+
assert result[1].find("ABORT") >= 0
396395

397396
statement = r"""/*comment1*/
398397
\h
399398
/*comment4 */"""
400399
result = run(executor, statement, pgspecial=pgspecial)
401400
assert result is not None
402-
assert result[0].find("No help") >= 0
401+
assert result[1].find("ALTER") >= 0
402+
assert result[1].find("ABORT") >= 0
403403

404-
# TODO: same for this one
405404
statement = """/*comment1
406405
comment3
407406
comment2*/
@@ -411,7 +410,8 @@ def test_execute_commented_first_line_and_special(executor, pgspecial, tmpdir):
411410
comment6*/"""
412411
result = run(executor, statement, pgspecial=pgspecial)
413412
assert result is not None
414-
assert result[0].find("No help") >= 0
413+
assert result[1].find("ALTER") >= 0
414+
assert result[1].find("ABORT") >= 0
415415

416416

417417
@dbtest

0 commit comments

Comments
 (0)