-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spdx3: write_snippet: fix the presentation of line and byte ranges
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 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,25 @@ | ||
import io | ||
|
||
from spdx_tools.spdx3.model.positive_integer_range import PositiveIntegerRange | ||
from spdx_tools.spdx3.model.software import Snippet | ||
from spdx_tools.spdx3.writer.console.software.snippet_writer import write_snippet | ||
|
||
|
||
def test_render_creation_info(): | ||
snippet = Snippet( | ||
spdx_id="SPDXRef-Snippet", | ||
byte_range=PositiveIntegerRange(0, 3), | ||
line_range=PositiveIntegerRange(1, 2), | ||
) | ||
output_str = io.StringIO() | ||
write_snippet(snippet, text_output=output_str) | ||
|
||
assert ( | ||
output_str.getvalue() | ||
== """\ | ||
## Snippet | ||
SPDXID: SPDXRef-Snippet | ||
byte_range: 0:3 | ||
line_range: 1:2 | ||
""" | ||
) |