From 43ac47cd6dea50f069a11134e1d8dc5405ced9ed Mon Sep 17 00:00:00 2001 From: Nicola Coretti Date: Wed, 13 Mar 2024 08:54:18 +0100 Subject: [PATCH] Integrate review feedback --- exasol/toolbox/release/__init__.py | 5 +++++ test/unit/cli_test.py | 1 + test/unit/git_test.py | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/exasol/toolbox/release/__init__.py b/exasol/toolbox/release/__init__.py index bb7d5bc9..48f527f6 100644 --- a/exasol/toolbox/release/__init__.py +++ b/exasol/toolbox/release/__init__.py @@ -49,6 +49,11 @@ def __eq__(self, other): @staticmethod def from_string(version): parts = [int(number, base=0) for number in version.split(".")] + if len(parts) > 3: + raise ValueError( + "Version has an invalid format, " + f"expected: '..', actual: '{version}'" + ) version = [_index_or(parts, i, 0) for i in range(3)] return Version(*version) diff --git a/test/unit/cli_test.py b/test/unit/cli_test.py index 9101ef12..29ed8ab6 100644 --- a/test/unit/cli_test.py +++ b/test/unit/cli_test.py @@ -9,6 +9,7 @@ @pytest.mark.parametrize( "version_string,expected_error", [ + ("4.4.4.4", ArgumentTypeError), ("1.b.a", ArgumentTypeError), ("F.b.a", ArgumentTypeError), ("F", ArgumentTypeError), diff --git a/test/unit/git_test.py b/test/unit/git_test.py index 55890b0f..46dfd07d 100644 --- a/test/unit/git_test.py +++ b/test/unit/git_test.py @@ -15,16 +15,16 @@ def git_tag(): stdout=cleandoc( """ 0.0.1 + 0.6.2 0.1.0 0.2.0 + 0.5.0 0.3.0 0.4.0 - 0.5.0 0.6.0 0.6.1 - 0.6.2 - 0.7.0 0.8.0 + 0.7.0 """ ).encode("utf8"), stderr="",