Skip to content

Commit

Permalink
Fix #9
Browse files Browse the repository at this point in the history
  • Loading branch information
k-bx committed Sep 24, 2014
1 parent ec460c4 commit 0697584
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.emacs-project
*.pyc
dist/
.venv
2 changes: 2 additions & 0 deletions semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def compare_by_keys(d1, d2):
return v
rc1, rc2 = d1.get('prerelease'), d2.get('prerelease')
rccmp = nat_cmp(rc1, rc2)
if not (rc1 or rc2):
return rccmp
if not rc1:
return 1
elif not rc2:
Expand Down
3 changes: 3 additions & 0 deletions tests/semver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def test_should_compare_rc_builds(self):
def test_should_compare_release_candidate_with_release(self):
self.assertEqual(compare('1.0.0-rc.1+build.1', '1.0.0'), -1)

def test_should_say_equal_versions_are_equal(self):
self.assertEqual(compare("2.0.0", "2.0.0"), 0)


if __name__ == '__main__':
unittest.main()

0 comments on commit 0697584

Please sign in to comment.