Skip to content

Fix #251: return VersionInfo for next_version #255

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,34 @@ Change Log
All notable changes to this code base will be documented in this file,
in every released version.


Version 2.10.1 (WIP)
====================

:Released: 2020-0x-0y
:Maintainer:


Features
--------


Bug Fixes
---------

* :gh:`251` (:pr:`000`): Fixed return type of ``semver.VersionInfo.next_version``
to always return a ``VersionInfo`` instance.


Additions
---------


Removals
--------



Version 2.10.0
==============

Expand Down
2 changes: 1 addition & 1 deletion semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def next_version(self, part, prerelease_token="rc"):
return version.replace(prerelease=None, build=None)

if part in ("major", "minor", "patch"):
return str(getattr(version, "bump_" + part)())
return getattr(version, "bump_" + part)()

if not version.prerelease:
version = version.bump_patch()
Expand Down
4 changes: 3 additions & 1 deletion test_semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,4 +1050,6 @@ def test_next_version_with_invalid_parts():
)
def test_next_version_with_versioninfo(version, part, expected):
ver = VersionInfo.parse(version)
assert str(ver.next_version(part)) == expected
nxt = ver.next_version(part)
assert isinstance(nxt, VersionInfo)
assert str(nxt) == expected