void () { final PyRequirement requirement = fromLine("foo==1.1.*"); final PyPackage release = new PyPackage("foo", "1.1.2"); final PyPackage pre = new PyPackage("foo", "1.1.2a1"); final PyPackage post = new PyPackage("foo", "1.1.2.post1"); final PyPackage dev = new PyPackage("foo", "1.1.2.dev1"); final PyPackage localVersion = new PyPackage("foo", "1.1.2+local.version"); assertEquals(release, requirement.match(singletonList(release))); assertEquals(pre, requirement.match(singletonList(pre))); assertEquals(post, requirement.match(singletonList(post))); assertEquals(dev, requirement.match(singletonList(dev))); assertEquals(localVersion, requirement.match(singletonList(localVersion))); final PyRequirement negativeRequirement = fromLine("foo!=1.1.*"); final PyPackage negativeRelease = new PyPackage("foo", "1.2.2"); final PyPackage negativePre = new PyPackage("foo", "1.2.2a1"); final PyPackage negativePost = new PyPackage("foo", "1.2.2.post1"); final PyPackage negativeDev = new PyPackage("foo", "1.2.2.dev1"); final PyPackage negativeLocalVersion = new PyPackage("foo", "1.2.2+local.version"); assertNull(negativeRequirement.match(Arrays.asList(release, pre, post, dev, localVersion))); assertEquals(negativeRelease, negativeRequirement.match(singletonList(negativeRelease))); assertEquals(negativePre, negativeRequirement.match(singletonList(negativePre))); assertEquals(negativePost, negativeRequirement.match(singletonList(negativePost))); assertEquals(negativeDev, negativeRequirement.match(singletonList(negativeDev))); assertEquals(negativeLocalVersion, negativeRequirement.match(singletonList(negativeLocalVersion))); }