def testVersionComparison(self): versions = version._ApiVersions(('v1beta15', 'v1beta16', 'v1')) v1beta15 = versions.get('v1beta15') v1beta16 = versions.get('v1beta16') self.assertEqual(0, v1beta15._index) self.assertEqual(1, v1beta16._index) self.assertEqual(2, versions.get('v1')._index) self.assertTrue(v1beta15 < v1beta16) self.assertTrue(v1beta15 != v1beta16) self.assertTrue(v1beta15 <= v1beta16) self.assertFalse(v1beta15 > v1beta16) self.assertFalse(v1beta15 >= v1beta16) self.assertFalse(v1beta15 == v1beta16) self.assertTrue(v1beta16 > v1beta15) self.assertTrue(v1beta16 != v1beta15) self.assertTrue(v1beta16 >= v1beta15) self.assertFalse(v1beta16 < v1beta15) self.assertFalse(v1beta16 <= v1beta15) self.assertFalse(v1beta16 == v1beta15) self.assertEqual(v1beta15, v1beta15) self.assertEqual(v1beta15, version._ApiVersion('v1beta15', 0, versions))
def testVersionStringComparison(self): versions = version._ApiVersions(('v1', 'v2', 'v3')) v2 = versions.get('v2') self.assertTrue(v2 < 'v3') self.assertTrue('v1' < v2) self.assertEqual('v2', v2) self.assertEqual(v2, 'v2') self.assertNotEqual(v2, versions.get('v3')) self.assertNotEqual(v2, 'v1')
def testVersionComparison(self): versions = version._ApiVersions(('v1beta16', 'v1', 'v2beta1')) v1beta16 = versions.get('v1beta16') v1 = versions.get('v1') self.assertEqual(0, v1beta16._index) self.assertEqual(1, versions.get('v1')._index) self.assertTrue(v1beta16 != v1) self.assertFalse(v1beta16 == v1) self.assertEqual(v1beta16, v1beta16) self.assertEqual(v1beta16, version._ApiVersion('v1beta16', 0, versions))
def testVersionGetItem(self): versions = version._ApiVersions(('v1', 'v2', 'v3')) v1 = versions['v1'] v2 = versions['v2'] v3 = versions['v3'] self.assertTrue(v1 < v2 < v3)
def testVersionComparison(self): versions = version._ApiVersions(('v1', )) v1 = versions.get('v1') self.assertEqual(0, v1._index)
def testVersionComparison(self): versions = version._ApiVersions(('v1',)) v1 = versions.get('v1') self.assertEqual(0, v1._index)