-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
非推奨化されたdistutils.versionへの依存をなくし、python-semverに移行する (#609)
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
- Loading branch information
Showing
11 changed files
with
80 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from unittest import TestCase | ||
|
||
from voicevox_engine.utility import get_latest_core_version, parse_core_version | ||
|
||
|
||
class TestCoreVersion(TestCase): | ||
def test_parse_core_version(self): | ||
parse_core_version("0.0.0") | ||
parse_core_version("0.1.0") | ||
parse_core_version("0.10.0") | ||
parse_core_version("0.10.0-preview.1") | ||
parse_core_version("0.14.0") | ||
parse_core_version("0.14.0-preview.1") | ||
parse_core_version("0.14.0-preview.10") | ||
|
||
def test_get_latest_core_version(self): | ||
self.assertEqual( | ||
get_latest_core_version( | ||
versions=[ | ||
"0.0.0", | ||
"0.1.0", | ||
"0.10.0", | ||
"0.10.0-preview.1", | ||
"0.14.0", | ||
"0.14.0-preview.1", | ||
"0.14.0-preview.10", | ||
] | ||
), | ||
"0.14.0", | ||
) | ||
|
||
self.assertEqual( | ||
get_latest_core_version( | ||
versions=[ | ||
"0.14.0", | ||
"0.15.0-preview.1", | ||
] | ||
), | ||
"0.15.0-preview.1", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from typing import Iterable | ||
|
||
from semver.version import Version | ||
|
||
|
||
def parse_core_version(version: str) -> Version: | ||
return Version.parse(version) | ||
|
||
|
||
def get_latest_core_version(versions: Iterable[str]) -> str: | ||
if len(versions) == 0: | ||
raise Exception("versions must be non-empty.") | ||
|
||
return str(max(map(parse_core_version, versions))) |