Repository: python-semver/python-semver (python)

Issue:
bump_build() and bump_prerelease() have the wrong rtype
These two methods return `VersionInfo` objects, the `rtype` in the docstring says that they return a `str`.

Pull request description:
Fix #252: Correct wrong str type in docstring
Type should be VersionInfo instead of str in ``VersionInfo.bump_build`` and `VersionInfo.bump_prerelease`

@tlaferriere: could you have a look please?

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 94564c7..028e7fe 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -6,6 +6,32 @@ 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:`254`): Fixed return type of ``semver.VersionInfo.next_version``
+  to always return a ``VersionInfo`` instance.
+
+
+Additions
+---------
+
+
+Removals
+--------
+
+
 Version 2.10.0
 ==============
 
diff --git a/semver.py b/semver.py
index c2697dd..b9de42b 100644
--- a/semver.py
+++ b/semver.py
@@ -328,7 +328,7 @@ class VersionInfo(object):
         untouched.
 
         :return: new object with the raised major part
-        :rtype: VersionInfo
+        :rtype: :class:`VersionInfo`
 
         >>> ver = semver.VersionInfo.parse("3.4.5")
         >>> ver.bump_major()
@@ -343,7 +343,7 @@ class VersionInfo(object):
         untouched.
 
         :return: new object with the raised minor part
-        :rtype: VersionInfo
+        :rtype: :class:`VersionInfo`
 
         >>> ver = semver.VersionInfo.parse("3.4.5")
         >>> ver.bump_minor()
@@ -358,7 +358,7 @@ class VersionInfo(object):
         untouched.
 
         :return: new object with the raised patch part
-        :rtype: VersionInfo
+        :rtype: :class:`VersionInfo`
 
         >>> ver = semver.VersionInfo.parse("3.4.5")
         >>> ver.bump_patch()
@@ -374,7 +374,7 @@ class VersionInfo(object):
 
         :param token: defaults to 'rc'
         :return: new object with the raised prerelease part
-        :rtype: str
+        :rtype: :class:`VersionInfo`
 
         >>> ver = semver.VersionInfo.parse("3.4.5-rc.1")
         >>> ver.bump_prerelease()
@@ -392,7 +392,7 @@ build=None)
 
         :param token: defaults to 'build'
         :return: new object with the raised build part
-        :rtype: str
+        :rtype: :class:`VersionInfo`
 
         >>> ver = semver.VersionInfo.parse("3.4.5-rc.1+build.9")
         >>> ver.bump_build()
@@ -471,7 +471,8 @@ build='build.10')
 
         :param part: One of "major", "minor", "patch", or "prerelease"
         :param prerelease_token: prefix string of prerelease, defaults to 'rc'
-        :return:
+        :return: new object with the appropriate part raised
+        :rtype: :class:`VersionInfo`
         """
         validparts = {
             "major",
@@ -495,7 +496,7 @@ build='build.10')
             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()


Test patch:
diff --git a/test_semver.py b/test_semver.py
index db0c7f4..8ecc81f 100644
--- a/test_semver.py
+++ b/test_semver.py
@@ -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
+    next_version = ver.next_version(part)
+    assert isinstance(next_version, VersionInfo)
+    assert str(next_version) == expected