def test_complex(self): v1 = Ckan.Version('v6a12') v2 = Ckan.Version('v6a5') self.assertLess(v2, v1) self.assertGreater(v1, v2) self.assertNotEqual(v1, v2)
class TestCkanComplex(unittest.TestCase): def setUp(self): self.ckan = Ckan(contents="""{ "spec_version": "v1.4", "identifier": "AwesomeMod", "version": "1.0.0", "ksp_version": "1.7.3", "author": [ "techman83", "DasSkelett", "politas" ], "license": [ "CC-BY-NC-SA-4.0", "GPL-3.0", "MIT" ], "kind": "metapackage" }""") def test_explicit_kind(self): self.assertEqual(self.ckan.kind, "metapackage") def test_authors(self): self.assertEqual(self.ckan.authors(), ["techman83", "DasSkelett", "politas"]) def test_licenses(self): self.assertEqual(self.ckan.licenses(), ["CC-BY-NC-SA-4.0", "GPL-3.0", "MIT"]) def test_version(self): self.assertEqual('1.0.0', self.ckan.version.string)
class TestCkanSimple(unittest.TestCase): def setUp(self): self.ckan = Ckan(contents="""{ "spec_version": "v1.4", "identifier": "AwesomeMod", "version": "1.0.0", "ksp_version": "1.7.3", "author": "techman83", "license": "CC-BY-NC-SA-4.0", "download": "https://awesomesite.org/awesomemod-1.0.0.zip", "download_content_type": "application/zip" }""") def test_basic_properties(self): self.assertEqual(self.ckan.spec_version, "v1.4") self.assertEqual(self.ckan.identifier, "AwesomeMod") self.assertEqual(self.ckan.version.string, "1.0.0") self.assertEqual(self.ckan.ksp_version, "1.7.3") def test_default_kind(self): self.assertEqual(self.ckan.kind, "package") def test_authors(self): self.assertEqual(self.ckan.authors(), ["techman83"]) def test_licenses(self): self.assertEqual(self.ckan.licenses(), ["CC-BY-NC-SA-4.0"]) def test_cache(self): self.assertEqual(self.ckan.cache_prefix, "3C69B375") self.assertEqual(self.ckan.cache_filename, "3C69B375-AwesomeMod-1.0.0.zip")
def test_basic(self): v0 = Ckan.Version('1.2.0') v1 = Ckan.Version('1.2.0') v2 = Ckan.Version('1.2.1') self.assertLess(v1, v2) self.assertGreater(v2, v1) self.assertEqual(v1, v0)
def test_dotSeparatorForExtraData(self): v0 = Ckan.Version('1.0') v1 = Ckan.Version('1.0.repackaged') v2 = Ckan.Version('1.0.1') self.assertLess(v0, v1) self.assertLess(v1, v2) self.assertGreater(v1, v0) self.assertGreater(v2, v1)
def setUp(self): self.ckan = Ckan(contents="""{ "spec_version": "v1.4", "identifier": "AwesomeMod", "version": "1.0.0", "ksp_version": "1.7.3", "author": [ "techman83", "DasSkelett", "politas" ], "license": [ "CC-BY-NC-SA-4.0", "GPL-3.0", "MIT" ], "kind": "metapackage" }""")
def setUp(self): self.ckan = Ckan(contents="""{ "spec_version": "v1.4", "identifier": "AwesomeMod", "version": "1.0.0", "ksp_version": "1.7.3", "author": "techman83", "license": "CC-BY-NC-SA-4.0", "download": "https://awesomesite.org/awesomemod-1.0.0.zip", "download_content_type": "application/zip" }""")
def setUp(self): self.ckan = Ckan(contents="""{ "spec_version": "v1.4", "identifier": "NASA-CountDown", "version": "1.3.9.1", "ksp_version": "1.8", "author": "linuxgurugamer", "license": "CC-BY-NC-SA", "download": "https://spacedock.info/mod/1462/NASA%20CountDown%20Clock%20Updated/download/1.3.9.1", "download_content_type": "application/zip" }""")
def test_agExt(self): v1 = Ckan.Version('1.20') v2 = Ckan.Version('1.22a') self.assertGreater(v2, v1)
def test_Epoch(self): v1 = Ckan.Version('1.2.0') v2 = Ckan.Version('1:1.2.0') self.assertLess(v1, v2)
def test_unevenVersioning(self): v0 = Ckan.Version('1.1.0.0') v1 = Ckan.Version('1.1.1') self.assertLess(v0, v1) self.assertGreater(v1, v0)
def test_sortAllNumbersBeforeDot(self): v0 = Ckan.Version('1.0_beta') v1 = Ckan.Version('1.0.1_beta') self.assertLess(v0, v1) self.assertGreater(v1, v0)
def test_alpha(self): v1 = Ckan.Version('apple') v2 = Ckan.Version('banana') self.assertLess(v1, v2)
def test_str(self): string = '1.2.3' v1 = Ckan.Version(string) self.assertEqual(string, str(v1)) self.assertEqual(string, v1.string)
def setUp(self): self.ckan = Ckan(contents='{}')
def test_differentEpochs(self): v1 = Ckan.Version('1:1') v2 = Ckan.Version('2:1') self.assertNotEqual(v1, v2)
def test_testSuite(self): v1 = Ckan.Version('1.0') v2 = Ckan.Version('2.0') self.assertTrue(v1 < v2)
def test_issue1076(self): v0 = Ckan.Version('1.01') v1 = Ckan.Version('1.1') self.assertEqual(v1, v0)