Skip to content

Commit

Permalink
Do not add newlines to empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Feb 21, 2024
1 parent 512311c commit ebf84d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tested/dsl/translate_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ReturnOracle:


def _ensure_trailing_newline(text: str) -> str:
if not text.endswith("\n"):
if text and not text.endswith("\n"):
return text + "\n"
else:
return text
Expand Down
2 changes: 1 addition & 1 deletion tests/test_dsl_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1099,4 +1099,4 @@ def test_empty_text_data_newlines():
json_str = translate_to_test_suite(yaml_str)
suite = parse_test_suite(json_str)
actual_stderr = suite.tabs[0].contexts[0].testcases[0].output.stderr.data
assert actual_stderr == "\n"
assert actual_stderr == ""

0 comments on commit ebf84d8

Please sign in to comment.