Skip to content

Commit

Permalink
Merge pull request #13 from m-vdb/fix-dev-versions
Browse files Browse the repository at this point in the history
Fix dev versions
  • Loading branch information
m-vdb authored Jun 14, 2024
2 parents 2cc3a4b + 25d4145 commit 26e725b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit 26e725b

Please sign in to comment.