vers.NewRange returns a Range with an empty Scheme. ToVersString(r, "pypi") then checks each interval for emptiness with the default semver comparison instead of the scheme it was given, so valid PyPI intervals are dropped.
a, _ := vers.Parse("vers:pypi/>=2016.11.0|<3003rc1")
fmt.Println(vers.ToVersString(vers.NewRange(a.Intervals), "pypi"))
// got: vers:pypi/
// want: vers:pypi/>=2016.11.0|<3003rc1
>=0.5.0b3.dev13|<0.5.0b3.dev97 fails the same way. Parsing is correct: a.Contains("2019.2.0") is true and a.IsEmpty() is false. Setting Scheme: "pypi" on the range gives the right output.
This is seen in v0.7.0 and v0.7.1.
Suggested fix: ToVersString could use its scheme argument when r.Scheme is empty. Alternatively, NewRange could take a scheme.
vers.NewRangereturns a Range with an emptyScheme.ToVersString(r, "pypi")then checks each interval for emptiness with the default semver comparison instead of the scheme it was given, so valid PyPI intervals are dropped.>=0.5.0b3.dev13|<0.5.0b3.dev97fails the same way. Parsing is correct:a.Contains("2019.2.0")is true anda.IsEmpty()is false. SettingScheme: "pypi"on the range gives the right output.This is seen in v0.7.0 and v0.7.1.
Suggested fix:
ToVersStringcould use itsschemeargument whenr.Schemeis empty. Alternatively,NewRangecould take a scheme.