Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Implement tools.Version (based on SemVer) #4963
I don't understand your comment, sorry. Just to make it clear: if we don't take into account things like prereleases/microversion/build/meta/... (like it is implemented right now), then:
v1 = Version("1.2") v2 = Version("1.2-dev0") # Compare ALL the components self.assertTrue(v1.major == v2.major) self.assertTrue(v1.minor == v2.minor) self.assertTrue(v1.patch == v2.patch) # ... nothing more to compare # So... self.assertTrue(v1 == v2) self.assertFalse(v1 > v2) self.assertFalse(v1 < v2)
It makes sense because this
For me, it doesn't make sense at all. One thing is exposing some getters and a different thing is comparing incorrectly on purpose. But let's make sense for everyone, it is a wrapper so it's very easy, implement the getters for the "prerelease" and the "build" and make the comparison correct for these fields too.