From 32e3d2d4b8ba9f5534c93390e6affaaa3751c430 Mon Sep 17 00:00:00 2001 From: Brandon Lum Date: Fri, 11 Aug 2023 16:10:21 -0400 Subject: [PATCH] fix test to correctly use assumption of no comments in relationships Signed-off-by: Brandon Lum --- src/spdx_tools/spdx/parser/jsonlikedict/relationship_parser.py | 1 + tests/spdx/parser/jsonlikedict/test_relationship_parser.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spdx_tools/spdx/parser/jsonlikedict/relationship_parser.py b/src/spdx_tools/spdx/parser/jsonlikedict/relationship_parser.py index 881297c44..459361269 100644 --- a/src/spdx_tools/spdx/parser/jsonlikedict/relationship_parser.py +++ b/src/spdx_tools/spdx/parser/jsonlikedict/relationship_parser.py @@ -125,6 +125,7 @@ def parse_document_describes( def parse_has_files( self, package_dicts: List[Dict], existing_relationships: List[Relationship] ) -> List[Relationship]: + # assume existing relationships are stripped of comments logger = Logger() contains_relationships = [] for package in package_dicts: diff --git a/tests/spdx/parser/jsonlikedict/test_relationship_parser.py b/tests/spdx/parser/jsonlikedict/test_relationship_parser.py index 327a83f6c..dae0e90d7 100644 --- a/tests/spdx/parser/jsonlikedict/test_relationship_parser.py +++ b/tests/spdx/parser/jsonlikedict/test_relationship_parser.py @@ -169,6 +169,7 @@ def test_parse_has_files(): @pytest.mark.parametrize( "has_files,existing_relationships,contains_relationships", [ + # pre-requisite for parse_has_files requires that comments in relationships are stripped ( ["SPDXRef-File1", "SPDXRef-File2"], [ @@ -176,7 +177,6 @@ def test_parse_has_files(): spdx_element_id="SPDXRef-Package", relationship_type=RelationshipType.CONTAINS, related_spdx_element_id="SPDXRef-File1", - comment="This relationship has a comment.", ), Relationship( spdx_element_id="SPDXRef-File2",