10000 [refactor] move comment to the end of extractedLicensingInfo constructor · spdx/tools-python@7aa8bb9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7aa8bb9

Browse files
[refactor] move comment to the end of extractedLicensingInfo constructor
this makes sense as it is the only unconditionally optional parameter Signed-off-by: Armin Tänzer <armin.taenzer@tngtech.com>
1 parent b617d8d commit 7aa8bb9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/model/extracted_licensing_info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ class ExtractedLicensingInfo:
2020
license_id: Optional[str] = None
2121
extracted_text: Optional[str] = None
2222
license_name: Optional[str] = None
23-
comment: Optional[str] = None
2423
cross_references: List[str] = field(default_factory=list)
24+
comment: Optional[str] = None
2525

2626
def __init__(self, license_id: Optional[str] = None, extracted_text: Optional[str] = None,
27-
license_name: Optional[str] = None, comment: Optional[str] = None,
28-
cross_references: List[str] = None):
27+
license_name: Optional[str] = None, cross_references: List[str] = None,
28+
comment: Optional[str] = None):
2929
cross_references = [] if cross_references is None else cross_references
3030
check_types_and_set_values(self, locals())

tests/model/test_extracted_licensing_info.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55

66
def test_correct_initialization():
7-
extracted_licensing_info = ExtractedLicensingInfo("id", "text", "name", "comment", ["reference"])
7+
extracted_licensing_info = ExtractedLicensingInfo("id", "text", "name", ["reference"], "comment")
88
assert extracted_licensing_info.license_id == "id"
99
assert extracted_licensing_info.extracted_text == "text"
1010
assert extracted_licensing_info.license_name == "name"
11-
assert extracted_licensing_info.comment == "comment"
1211
assert extracted_licensing_info.cross_references == ["reference"]
12+
assert extracted_licensing_info.comment == "comment"
1313

1414

1515
def test_wrong_type_in_license_id():
@@ -27,11 +27,11 @@ def test_wrong_type_in_license_name():
2727
ExtractedLicensingInfo(license_name=42)
2828

2929

30-
def test_wrong_type_in_comment():
30+
def test_wrong_type_in_cross_references():
3131
with pytest.raises(TypeError):
32-
ExtractedLicensingInfo(comment=42)
32+
ExtractedLicensingInfo(cross_references=["ref", 42])
3333

3434

35-
def test_wrong_type_in_cross_references():
35+
def test_wrong_type_in_comment():
3636
with pytest.raises(TypeError):
37-
ExtractedLicensingInfo(cross_references=["ref", 42])
37+
ExtractedLicensingInfo(comment=42)

0 commit comments

Comments
 (0)
0