-
Notifications
You must be signed in to change notification settings - Fork 145
[issue-788] fix tag-value parser to allow NONE and NOASSERTION for pa… #816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a78f9d0
937b788
215bc38
cd676e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ckage source info as they are valid strings Signed-off-by: Meret Behrens <meret.behrens@tngtech.com> # fixes 788
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,26 @@ def test_parse_package(): | |
assert package.valid_until_date == datetime(2022, 1, 1, 12) | ||
|
||
|
||
def test_parse_package_with_no_assertion_as_source_info(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, this test should include all fields that can sport text only, all filled with either NONE or NOASSERTION. Might be bit overkill, though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding all cases would be overkill imho but I added a field that contains NONE and is parsed as text. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to rename this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, I also moved the test to the |
||
parser = Parser() | ||
package_str = "\n".join( | ||
[ | ||
"PackageName: Test", | ||
"SPDXID: SPDXRef-Package", | ||
"PackageDownloadLocation: http://example.com/test", | ||
"FilesAnalyzed: true", | ||
"PackageSummary: <text>Test package</text>", | ||
"PackageSourceInfo: NOASSERTION", | ||
] | ||
) | ||
document = parser.parse("\n".join([DOCUMENT_STR, package_str])) | ||
assert document is not None | ||
package = document.packages[0] | ||
assert package.name == "Test" | ||
assert package.spdx_id == "SPDXRef-Package" | ||
assert package.source_info == "NOASSERTION" | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"package_str, expected_message", | ||
[ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem at hand can also occur for other
text_or_line
fields apart fromsource_info
. Basically all properties that usetext_or_line
. So I would believe that the wholetext_or_line
8000 property has to be adapted, not only for the source information case.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the same problem will arise when somebody uses
NONE
. So best solve this one here, too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I changed the behaviour such that
text_or_line
parses NOASSERTION and NONE as regular strings and for fields that allow NOASSERTION or NONE, like the license fields these strings will be serialized as the correspondingSpdxNoAssertion
andSpdxNone
objects