def test_update(self): v = VersionInfo('1.0') v.update() self.assertEqual(v, VersionInfo('1.0')) v.update('1.0.0') self.assertEqual(v, VersionInfo('1.0', '1.0.0')) v.update('1.0.1', ['latest']) self.assertEqual(v, VersionInfo('1.0', '1.0.1', ['latest'])) v.update(aliases=['greatest']) self.assertEqual(v, VersionInfo('1.0', '1.0.1', ['latest', 'greatest']))
def test_update(self): v = VersionInfo('1.0') v.update() self.assertEqual(v, VersionInfo('1.0')) v.update('1.0.0') self.assertEqual(v, VersionInfo('1.0', '1.0.0')) v.update('1.0.1', ['latest']) self.assertEqual(v, VersionInfo('1.0', '1.0.1', ['latest'])) v.update(aliases=['greatest']) self.assertEqual(v, VersionInfo('1.0', '1.0.1', ['latest', 'greatest'])) with self.assertRaisesRegex(ValueError, "^'' is not a valid alias$"): v.update(aliases=['']) with self.assertRaisesRegex(ValueError, "^'..' is not a valid alias$"): v.update(aliases=['..']) with self.assertRaisesRegex(ValueError, "^'foo/bar' is not a valid alias$"): v.update(aliases=['foo/bar'])