def test_same_major_true(self): """Even though the current version is 2.0, since `same_major` defaults to `True`, 1.0 is deemed incompatible. """ self.assertFalse(versionutils.is_compatible('2.0', '1.0')) self.assertTrue(versionutils.is_compatible('1.0', '1.0')) self.assertFalse(versionutils.is_compatible('1.0', '2.0'))
def test_same_major_false(self): """With `same_major` set to False, then major version compatibiity rule is not enforced, so a current version of 2.0 is deemed to satisfy a requirement of 1.0. """ self.assertFalse( versionutils.is_compatible('2.0', '1.0', same_major=False)) self.assertTrue( versionutils.is_compatible('1.0', '1.0', same_major=False)) self.assertTrue( versionutils.is_compatible('1.0', '2.0', same_major=False))
def test_same_major_false(self): """With `same_major` set to False, then major version compatibiity rule is not enforced, so a current version of 2.0 is deemed to satisfy a requirement of 1.0. """ self.assertFalse(versionutils.is_compatible('2.0', '1.0', same_major=False)) self.assertTrue(versionutils.is_compatible('1.0', '1.0', same_major=False)) self.assertTrue(versionutils.is_compatible('1.0', '2.0', same_major=False))
def version_is_compatible(imp_version, version): """Determine whether versions are compatible. :param imp_version: The version implemented :param version: The version requested by an incoming message. """ return versionutils.is_compatible(version, imp_version)
def test_same_version(self): self.assertTrue(versionutils.is_compatible('1', '1')) self.assertTrue(versionutils.is_compatible('1.0', '1.0')) self.assertTrue(versionutils.is_compatible('1.0.0', '1.0.0'))
def test_current_patch_not_present_less_than(self): self.assertFalse(versionutils.is_compatible('1.0.1', '1.0'))
def test_current_patch_not_present_same(self): self.assertTrue(versionutils.is_compatible('1.0.0', '1.0'))
def test_requested_patch_not_present_less_than(self): self.assertTrue(versionutils.is_compatible('1.0', '1.0.1'))
def test_requested_patch_greater(self): self.assertFalse(versionutils.is_compatible('1.0.1', '1.0.0'))
def test_requested_minor_less_than(self): self.assertTrue(versionutils.is_compatible('1.0', '1.1'))