public void TestConvertVersionToTuple() { var invalidVersions = new string[] { "2.0", "a.0.0", "1.b.0", "3.4.d-pre.1", "1.9.0-prev.2", "1.2.0-pre.f" }; foreach (var version in invalidVersions) { Assert.Throws <PythonInstallException>(() => { PythonRunner.ConvertVersionToTuple(version); }); } var previewVersion = "1.1.1-preview.4"; var result = PythonRunner.ConvertVersionToTuple(previewVersion); Assert.That(result, Is.EqualTo((1, 1, 1, PythonRunner.BinariesPackageReleaseType.kPreview, 4))); var expVersion = "2.4.6-exp.2"; result = PythonRunner.ConvertVersionToTuple(expVersion); Assert.That(result, Is.EqualTo((2, 4, 6, PythonRunner.BinariesPackageReleaseType.kExperimental, 2))); var preVersion = "2.1.7-pre.1"; result = PythonRunner.ConvertVersionToTuple(preVersion); Assert.That(result, Is.EqualTo((2, 1, 7, PythonRunner.BinariesPackageReleaseType.kPreRelease, 1))); var releaseVersion = "3.5.7"; result = PythonRunner.ConvertVersionToTuple(releaseVersion); Assert.That(result, Is.EqualTo((3, 5, 7, PythonRunner.BinariesPackageReleaseType.kRelease, 0))); }