示例#1
0
def test_suggest_normalized_version(input, expected):
    assert suggest(input) == expected
示例#2
0
    def test_suggest_normalized_version(self):

        self.assertEqual(suggest('1.0'), '1.0')
        self.assertEqual(suggest('1.0-alpha1'), '1.0a1')
        self.assertEqual(suggest('1.0c2'), '1.0c2')
        self.assertEqual(suggest('walla walla washington'), None)
        self.assertEqual(suggest('2.4c1'), '2.4c1')
        self.assertEqual(suggest('v1.0'), '1.0')

        # from setuptools
        self.assertEqual(suggest('0.4a1.r10'), '0.4a1.post10')
        self.assertEqual(suggest('0.7a1dev-r66608'), '0.7a1.dev66608')
        self.assertEqual(suggest('0.6a9.dev-r41475'), '0.6a9.dev41475')
        self.assertEqual(suggest('2.4preview1'), '2.4c1')
        self.assertEqual(suggest('2.4pre1'), '2.4c1')
        self.assertEqual(suggest('2.1-rc2'), '2.1c2')

        # from pypi
        self.assertEqual(suggest('0.1dev'), '0.1.dev0')
        self.assertEqual(suggest('0.1.dev'), '0.1.dev0')

        # we want to be able to parse Twisted
        # development versions are like post releases in Twisted
        self.assertEqual(suggest('9.0.0+r2363'), '9.0.0.post2363')

        # pre-releases are using markers like "pre1"
        self.assertEqual(suggest('9.0.0pre1'), '9.0.0c1')

        # we want to be able to parse Tcl-TK
        # they us "p1" "p2" for post releases
        self.assertEqual(suggest('1.4p1'), '1.4.post1')
示例#3
0
except IOError:
    packages = client.list_packages()
    package_versions = [(p, client.package_releases(p, True)) for p in progress.bar.ShadyBar("Loading versions", max=len(packages)).iter(packages)]

    all_versions = []
    for p, vs in package_versions:
        all_versions.extend([(p, v) for v in vs])

    with open("version_data.pickle", "wb") as fp:
        pickle.dump((packages, package_versions, all_versions), fp, -1)

for package, ver in progress.bar.ShadyBar("Trying packaging.version", max=len(all_versions)).iter(all_versions):
    try:
        Version(ver)
    except ValueError:
        suggested = suggest(ver)

        try:
            Version(suggested)
        except (ValueError, TypeError):
            results["packaging.version"]["invalid"].add((package, ver))
        else:
            results["packaging.version"]["fuzzy"].add((package, ver))
    else:
        results["packaging.version"]["valid"].add((package, ver))


for package, versions in progress.bar.ShadyBar("Check version ordering", max=len(package_versions)).iter(package_versions):
    pvers = []

    valid = True
示例#4
0
def test_suggest_normalized_version(input, expected):
    assert suggest(input) == expected