Repository: spdx/tools-python

Issue:
Version model fields must be integers but sometimes they aren't
**BACKGROUND INFORMATION**
`major` and `minor` fields of `Version` model are supposed to be integers and the class method `Version.from_str()` is responsible for assuring that.
https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/version.py#L36-L45
If `license_list_version` field is absent when initializing a `CreationInfo` object, a default value is taken from the `config.py` file.
https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/creationinfo.py#L131-L136
**THE ISSUE**
The default `Version` object described above is created assigning `major` and `minor` fields directly as string values.
https://github.com/spdx/tools-python/blob/301d72f6ae57c832c1da7f6402fa49b192de6810/spdx/config.py#L48-L49
`__lt__` method and parsers tests (expect integer values) may fail.

Comments:

Patch:
diff --git a/spdx/config.py b/spdx/config.py
index 59a11b4..1d80666 100644
--- a/spdx/config.py
+++ b/spdx/config.py
@@ -34,7 +34,7 @@ def load_license_list(file_name):
     licenses_map = {}
     with codecs.open(file_name, 'rb', encoding='utf-8') as lics:
         licenses = json.load(lics)
-        version = licenses['licenseListVersion'].split('.')
+        version, _, _ = licenses['licenseListVersion'].split('-')
         for lic in licenses['licenses']:
             if lic.get('isDeprecatedLicenseId'):
                 continue
@@ -54,7 +54,7 @@ def load_exception_list(file_name):
     exceptions_map = {}
     with codecs.open(file_name, 'rb', encoding='utf-8') as excs:
         exceptions = json.load(excs)
-        version = exceptions['licenseListVersion'].split('.')
+        version, _, _  = exceptions['licenseListVersion'].split('-')
         for exc in exceptions['exceptions']:
             if exc.get('isDeprecatedLicenseId'):
                 continue
@@ -65,8 +65,8 @@ def load_exception_list(file_name):
     return version, exceptions_map
 
 
-(_major, _minor), LICENSE_MAP = load_license_list(_licenses)
-LICENSE_LIST_VERSION = Version(major=_major, minor=_minor)
+_version, LICENSE_MAP = load_license_list(_licenses)
+LICENSE_LIST_VERSION = Version.from_str(_version)
 
-(_major, _minor), EXCEPTION_MAP = load_exception_list(_exceptions)
-EXCEPTION_LIST_VERSION = Version(major=_major, minor=_minor)
\ No newline at end of file
+_version, EXCEPTION_MAP = load_exception_list(_exceptions)
+EXCEPTION_LIST_VERSION = Version.from_str(_version)


Test patch:
diff --git a/tests/test_config.py b/tests/test_config.py
new file mode 100644
index 0000000..3db5f6e
--- /dev/null
+++ b/tests/test_config.py
@@ -0,0 +1,43 @@
+from __future__ import absolute_import
+from __future__ import print_function
+from __future__ import unicode_literals
+
+import unittest
+from unittest import TestCase
+
+from spdx import config
+from spdx.version import Version
+
+class TestLicenseList(TestCase):
+
+    def test_load_license_list(self):
+        version, licenses_map = config.load_license_list(config._licenses)
+        assert version == '3.5'
+        # Test some instances in licenses_map
+        assert licenses_map['MIT License'] == 'MIT'
+        assert licenses_map['MIT'] == 'MIT License'
+        assert licenses_map['Apache License 2.0'] == 'Apache-2.0'
+        assert licenses_map['Apache-2.0'] == 'Apache License 2.0'
+        assert licenses_map['GNU General Public License v3.0 only'] == 'GPL-3.0-only'
+        assert licenses_map['GPL-3.0-only'] == 'GNU General Public License v3.0 only'
+    
+    def test_config_license_list_version_constant(self):
+        assert config.LICENSE_LIST_VERSION == Version(major=3, minor=5)
+
+    def test_load_exception_list(self):
+        version, exception_map = config.load_exception_list(config._exceptions)
+        assert version == '3.5'
+        # Test some instances in exception_map
+        assert exception_map['Bison exception 2.2'] == 'Bison-exception-2.2'
+        assert exception_map['Bison-exception-2.2'] == 'Bison exception 2.2'
+        assert exception_map['OpenVPN OpenSSL Exception'] == 'openvpn-openssl-exception'
+        assert exception_map['openvpn-openssl-exception'] == 'OpenVPN OpenSSL Exception'
+        assert exception_map['Qt GPL exception 1.0'] == 'Qt-GPL-exception-1.0'
+        assert exception_map['Qt-GPL-exception-1.0'] == 'Qt GPL exception 1.0'
+    
+    def test_config_exception_list_version_constant(self):
+        assert config.EXCEPTION_LIST_VERSION == Version(major=3, minor=5)
+
+
+if __name__ == '__main__':
+    unittest.main()