packaging
packaging copied to clipboard
Arbitrary equality not matching when a prerelease? Even with `prereleases=True`
As part of my question (https://github.com/pypa/packaging/issues/762) I am writing an exhaustive set of tests for if something is contained within a specifier set, however this confused me:
SpecifierSet('===1.a1', prereleases=True).contains("1.a1")
This returns False
, which is not how I understand arbitrary equality. Is this a bug or expected behavior?
Ah, this is definitely a bug.
The specifier's version (1.a1
) ends up being normalised (1a1
) before being passed into the comparator, and that's why the comparision fails here.
The specifier's version (
1.a1
) ends up being normalised (1a1
) before being passed into the comparator, and that's why the comparision fails here.
Thanks for the info! For my use case of writing an exhaustive set of tests for the boundry conditions of SpecifierSet.contains I can just normalize all the version numbers ahead of time.
I expect we'd break that workflow once this is actually fixed, FWIW.