Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Mar 15, 2024
1 parent b57721a commit adef976
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ def test_uses_vcs_in_metadata(testing_workdir, testing_metadata):
def test_select_lines():
lines = "\n".join(
(
"",
"", # preserve leading newline
"test",
"test [abc] no",
"test [abc] # no",
" ' test ' ",
' " test " ',
"",
"# comment line",
"", # preserve newline
"# comment line", # preserve comment line (but not the comment)
"test [abc]",
" 'quoted # [abc] '",
' "quoted # [abc] yes "',
Expand All @@ -74,20 +74,20 @@ def test_select_lines():
"test {{ JINJA_VAR[:2] }} # stuff yes [abc]",
"test {{ JINJA_VAR[:2] }} # [abc] stuff yes",
'{{ environ["test"] }} # [abc]',
"", # trailing newline
"", # preserve trailing newline
)
)

assert select_lines(lines, {"abc": True}, variants_in_place=True) == "\n".join(
(
"",
"", # preserve leading newline
"test",
"test [abc] no",
"test [abc] # no",
" ' test '",
' " test "',
"",
"",
"", # preserve newline
"", # preserve comment line (but not the comment)
"test",
" 'quoted'",
' "quoted"',
Expand All @@ -97,21 +97,21 @@ def test_select_lines():
"test {{ JINJA_VAR[:2] }}",
"test {{ JINJA_VAR[:2] }}",
'{{ environ["test"] }}',
"", # trailing newline
"", # preserve trailing newline
)
)
assert select_lines(lines, {"abc": False}, variants_in_place=True) == "\n".join(
(
"",
"", # preserve leading newline
"test",
"test [abc] no",
"test [abc] # no",
" ' test '",
' " test "',
"",
"",
"", # preserve newline
"", # preserve comment line (but not the comment)
"test {{ JINJA_VAR[:2] }}",
"", # trailing newline
"", # preserve trailing newline
)
)

Expand Down

0 comments on commit adef976

Please sign in to comment.