-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(templating): Fix whitespace/newlines around sections
Every section is now preceeded by 2 empty lines. Trailing newlines at the very end were removed. Spacing was generally unified.
- Loading branch information
Showing
2 changed files
with
57 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
from rich.console import NewLine, RenderableType | ||
|
||
from ancv.visualization.templates import ensure_single_trailing_newline | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["input_sequence", "expected_sequence"], | ||
[ | ||
([], [NewLine()]), | ||
([1], [1, NewLine()]), | ||
([1, 2], [1, 2, NewLine()]), | ||
([1, 2, NewLine()], [1, 2, NewLine()]), | ||
([1, 2, NewLine(), NewLine()], [1, 2, NewLine()]), | ||
([1, NewLine(), NewLine(), NewLine(), NewLine()], [1, NewLine()]), | ||
([NewLine(), NewLine(), NewLine(), NewLine()], [NewLine()]), | ||
], | ||
) | ||
def test_ensure_single_trailing_newline( | ||
input_sequence: list[RenderableType], expected_sequence: list[RenderableType] | ||
) -> None: | ||
ensure_single_trailing_newline(input_sequence) | ||
|
||
for result, expected in zip(input_sequence, expected_sequence, strict=True): | ||
if isinstance(result, NewLine): # Cannot compare for equality | ||
assert isinstance(expected, NewLine) | ||
else: | ||
assert result == expected |