File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -280,9 +280,14 @@ class ExtractedLicensingInfo:
280280
281281 def as_dict (self ):
282282 """Return the data as a serializable dict."""
283+ if self .extracted_text .strip ():
284+ extracted_text = self .extracted_text
285+ else :
286+ extracted_text = "NOASSERTION"
287+
283288 required_data = {
284289 "licenseId" : self .license_id ,
285- "extractedText" : self . extracted_text ,
290+ "extractedText" : extracted_text ,
286291 }
287292
288293 optional_data = {
Original file line number Diff line number Diff line change @@ -318,6 +318,15 @@ def test_spdx_extracted_licensing_info_as_dict(self):
318318 licensing_info = spdx .ExtractedLicensingInfo (** self .licensing_info_data )
319319 assert self .licensing_info_spdx_data == licensing_info .as_dict ()
320320
321+ def test_spdx_extracted_licensing_info_empty_extracted_text (self ):
322+ licensing_info = spdx .ExtractedLicensingInfo (
323+ ** {
324+ "license_id" : "LicenseRef-1" ,
325+ "extracted_text" : " " ,
326+ }
327+ )
328+ assert "NOASSERTION" == licensing_info .as_dict ()["extractedText" ]
329+
321330 def test_spdx_extracted_licensing_info_from_data (self ):
322331 assert spdx .ExtractedLicensingInfo .from_data ({})
323332 licensing_info = spdx .ExtractedLicensingInfo .from_data (
You can’t perform that action at this time.
0 commit comments