Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object comparison works different than function comparison #54

Closed
Chive opened this issue May 11, 2017 · 1 comment
Closed

Object comparison works different than function comparison #54

Chive opened this issue May 11, 2017 · 1 comment

Comments

@Chive
Copy link

Chive commented May 11, 2017

Hi there!

I'm trying to use object comparison but I'm not getting the expected results:

>>> import semver

>>> v1 = '0.10.4'
>>> v2 = '0.10.4-beta.1'

"""
from: semver#compare
The return value is negative if ver1 < ver2,
zero if ver1 == ver2 and strictly positive if ver1 > ver2
"""
>>> semver.compare(v1, v2) > 0
True
>>> semver.compare(v2, v1) < 0
True

# until here, everythings works as expected

>>> v1o = semver.parse_version_info(v1)
>>> v2o = semver.parse_version_info(v2)

>>> v1o
VersionInfo(major=0, minor=10, patch=4, prerelease=None, build=None)
>>> v2o
VersionInfo(major=0, minor=10, patch=4, prerelease='beta.1', build=None)

# this is where things go wrong:
>>> v1o > v2o
False
>>> v2o < v1o
False
@k-bx
Copy link
Contributor

k-bx commented May 25, 2017

Fixed by #55

@k-bx k-bx closed this as completed May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants