diff --git a/imcsdk/imccoremeta.py b/imcsdk/imccoremeta.py index 78237e5c..d07fc466 100644 --- a/imcsdk/imccoremeta.py +++ b/imcsdk/imccoremeta.py @@ -122,13 +122,13 @@ def _set_versions(self, match_obj): # for spin builds 4.0(1S52), the patch version will be None # In this scenario assume the version to be highest patch z - if self.__patch is None: + if self.__spin is not None and self.__patch is None: self.__patch = 'z' - elif self.__patch.isdigit() and self.__mr.isdigit(): + elif self.__patch is not None and self.__mr is not None and self.__patch.isdigit() and self.__mr.isdigit(): log.debug("Interim version encountered: %s. MR version has been bumped up." % self.version) self.__mr = str(int(self.__mr) + 1) self.__patch = 'a' - elif self.__patch.isalpha() and self.__spin: + elif self.__patch is not None and self.__patch.isalpha() and self.__spin: log.debug("Interim version encountered: %s. patch version has been bumped up." % self.version) self.__patch = str(chr(ord(self.__patch)+1)) return True diff --git a/tests/unit_tests/common/test_imcversion.py b/tests/unit_tests/common/test_imcversion.py index bb3dc32c..f47baf37 100644 --- a/tests/unit_tests/common/test_imcversion.py +++ b/tests/unit_tests/common/test_imcversion.py @@ -89,9 +89,7 @@ def test_gt_different_major_version(): def test_patch_versions(): - # when we don't see a patch version we use z - # so 2.0(12) will be considerde as 2.0(12z) version1 = ImcVersion("2.0(12b)") version2 = ImcVersion("2.0(12)") - assert_equal((version1 > version2), False) + assert_equal((version1 > version2), True)