Skip to content

Update doc string for python 3.12 #418

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
wants to merge 3 commits into from
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
4 changes: 2 additions & 2 deletions docs/usage/convert-version-into-different-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ It is possible to convert a :class:`~semver.version.Version` instance:
* Into a dictionary with :meth:`~semver.version.Version.to_dict`::

>>> v = Version(major=3, minor=4, patch=5)
>>> v.to_dict()
OrderedDict([('major', 3), ('minor', 4), ('patch', 5), ('prerelease', None), ('build', None)])
>>> v.to_dict() #doctest: +SKIP
OrderedDict({'major': 3, 'minor': 4, 'patch': 5, 'prerelease': None, 'build': None})

* Into a tuple with :meth:`~semver.version.Version.to_tuple`::

Expand Down
4 changes: 2 additions & 2 deletions docs/usage/create-a-version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ Depending on your use case, the following methods are available:

To access individual parts, you can use the function :func:`semver.parse`::

>>> semver.parse("3.4.5-pre.2+build.4")
OrderedDict([('major', 3), ('minor', 4), ('patch', 5), ('prerelease', 'pre.2'), ('build', 'build.4')])
>>> semver.parse("3.4.5-pre.2+build.4") #doctest: +SKIP
OrderedDict({'major': 3, 'minor': 4, 'patch': 5, 'prerelease': 'pre.2', 'build': 'build.4'})

If you pass an invalid version string you will get a :py:exc:`ValueError`::

Expand Down
6 changes: 3 additions & 3 deletions src/semver/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ def to_dict(self) -> VersionDict:
:return: an OrderedDict with the keys in the order ``major``, ``minor``,
``patch``, ``prerelease``, and ``build``.

>>> semver.Version(3, 2, 1).to_dict()
OrderedDict([('major', 3), ('minor', 2), ('patch', 1), \
('prerelease', None), ('build', None)])
>>> semver.Version(3, 2, 1).to_dict() #doctest: +SKIP
OrderedDict({'major': 3, 'minor': 4, 'patch': 5, 'prerelease': None, \
'build': None})
"""
return collections.OrderedDict(
(
Expand Down
1 change: 1 addition & 0 deletions tests/test_semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_should_versioninfo_to_dict(version):
resultdict = version.to_dict()
assert isinstance(resultdict, dict), "Got type from to_dict"
assert list(resultdict.keys()) == ["major", "minor", "patch", "prerelease", "build"]
assert tuple(resultdict.values()) == tuple(version)


def test_should_versioninfo_to_tuple(version):
Expand Down