Skip to content

Commit

Permalink
Fixed bug in ParserElement.run_tests where comments would be displaye…
Browse files Browse the repository at this point in the history
…d using with_line_numbers, even if with_line_numbers was set to False.
  • Loading branch information
ptmcg committed Dec 26, 2021
1 parent 5e3e1bb commit 5771459
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Version 3.0.7 -
or WordEnd instead of just taking the default value. Originally posted
as a question by Parag on StackOverflow, good catch!

- Fixed bug in ParserElement.run_tests where comments would be displayed
using with_line_numbers, even if with_line_numbers was set to False.

- Added optional "min" and "max" arguments to `delimited_list`. PR
submitted by Marius, thanks!

Expand Down
2 changes: 1 addition & 1 deletion pyparsing/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2067,7 +2067,7 @@ def run_tests(
BOM = "\ufeff"
for t in tests:
if comment is not None and comment.matches(t, False) or comments and not t:
comments.append(pyparsing_test.with_line_numbers(t))
comments.append(pyparsing_test.with_line_numbers(t) if with_line_numbers else t)
continue
if not t:
continue
Expand Down

0 comments on commit 5771459

Please sign in to comment.