Skip to content
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

Fix dev versions #13

Merged
merged 2 commits into from
Jun 14, 2024
Merged
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
6 changes: 3 additions & 3 deletions pep440_version_utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def next_major(self) -> "Version":
"""
version = copy(self)
major = version.major + 1
if version.pre and not version.minor and not version.micro:
if (version.pre or version.dev) and not version.minor and not version.micro:
major = version.major
version._version = VersionNamedTuple(
epoch=version._version.epoch,
Expand All @@ -58,7 +58,7 @@ def next_minor(self) -> "Version":
"""
version = copy(self)
minor = version.minor + 1
if version.pre and not version.micro:
if (version.pre or version.dev) and not version.micro:
minor = version.minor
version._version = VersionNamedTuple(
epoch=version._version.epoch,
Expand All @@ -77,7 +77,7 @@ def next_micro(self) -> "Version":
"""
version = copy(self)
micro = version.micro + 1
if version.pre and version.micro > 0:
if (version.pre or version.dev) and version.micro > 0:
micro = version.micro
version._version = VersionNamedTuple(
epoch=version._version.epoch,
Expand Down
3 changes: 3 additions & 0 deletions tests/version_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_copy():
("2.0.0rc2", "2.0.0"),
("2.0.0b4", "2.0.0"),
("2.0.0b4.post1", "2.0.0"),
("2.0.0dev1", "2.0.0"),
]


Expand All @@ -48,6 +49,7 @@ def test_next_major(version_string, expected):
("1.2.0rc2", "1.2.0"),
("1.2.0b4", "1.2.0"),
("1.2.0b4.post1", "1.2.0"),
("1.2.0dev1", "1.2.0"),
]


Expand All @@ -70,6 +72,7 @@ def test_next_minor(version_string, expected):
("1.2.0rc2", "1.2.1"),
("1.2.0b4", "1.2.1"),
("1.2.0b4.post1", "1.2.1"),
("1.2.1dev1", "1.2.1"),
]


Expand Down
Loading