@@ -29,22 +29,71 @@ def test_property_exist():
2929 """
3030 from spdx_python_model import v3_0_1
3131
32- # " imports" replaced by "import" in 3.0.1
32+ # 3.0.1: "/Core/ imports" replaced by "/Core/ import"
3333 d = v3_0_1 .SpdxDocument ()
3434 assert hasattr (
3535 d , "import_"
36- ), "'import_' (import) attribute is missing from 'SpdxDocument'"
36+ ), "3.0.1: 'import_' (import) property is missing from 'SpdxDocument'"
3737
38- # " parameters" replaced by "parameter" in 3.0.1
38+ # 3.0.1: "/Build/ parameters" replaced by "Build/ parameter"
3939 b = v3_0_1 .build_Build ()
4040 assert hasattr (
4141 b , "build_parameter"
42- ), "'build_parameter' attribute is missing from 'build_Build'"
42+ ), "3.0.1: 'build_parameter' property is missing from 'build_Build'"
4343 assert not hasattr (
4444 b , "build_parameters"
45- ), "'build_parameters' attribute should not be presented in 'build_Build'"
45+ ), "3.0.1: 'build_parameters' attribute should not be presented in 'build_Build'"
46+
47+ # 3.0.1: "/Software/contentType" removed (duplicate of "/Core/contentType")
48+ f = v3_0_1 .software_File ()
49+ assert hasattr (
50+ f , "contentType"
51+ ), "3.0.1: 'contentType' property is missing from 'software_File'"
52+ assert not hasattr (
53+ f , "software_contentType"
54+ ), "3.0.1: 'software_contentType' attribute should not be presented in 'software_File'"
4655
4756 p = v3_0_1 .ai_AIPackage ()
4857 assert hasattr (
4958 p , "ai_domain"
50- ), "'ai_domain' attribute is missing from 'ai_AIPackage'"
59+ ), "3.0.1: 'ai_domain' property is missing from 'ai_AIPackage'"
60+
61+
62+ def test_vocab_entry_exist ():
63+ """
64+ Test the existence of specific vocabulary entries in SPDX versions
65+
66+ Based on the change log:
67+ https://github.com/spdx/spdx-3-model/blob/develop/CHANGELOG.md
68+ """
69+
70+ from spdx_python_model import v3_0_1
71+
72+ # 3.0.1: "adler32" added to "/Core/HashAlgorithm"
73+ h = v3_0_1 .HashAlgorithm ()
74+ assert hasattr (
75+ h , "adler32"
76+ ), "3.0.1: 'adler32' entry is missing from 'HashAlgorithm'"
77+
78+ # 3.0.1: "hasPrerequsite" (misspelled) replaced by "hasPrerequisite"
79+ r = v3_0_1 .RelationshipType ()
80+ assert not hasattr (
81+ r , "hasPrerequsite"
82+ ), "3.0.1: 'hasPrerequsite' (misspelled) entry should not be presented in 'RelationshipType'"
83+
84+
85+ def test_special_individual_exist ():
86+ """
87+ Test the existence of specific individuals in SPDX versions
88+
89+ Based on the change log:
90+ https://github.com/spdx/spdx-3-model/blob/develop/CHANGELOG.md
91+ """
92+
93+ from spdx_python_model import v3_0_1
94+
95+ # 3.0.1: "SpdxOrganization" added
96+ o = v3_0_1 .Organization ()
97+ assert (
98+ "SpdxOrganization" in o .NAMED_INDIVIDUALS
99+ ), "3.0.1: 'SpdxOrganization' is missing"
0 commit comments