diff --git a/src/hera/workflows/io/_io_mixins.py b/src/hera/workflows/io/_io_mixins.py index aa01ae8dc..98f7804ee 100644 --- a/src/hera/workflows/io/_io_mixins.py +++ b/src/hera/workflows/io/_io_mixins.py @@ -1,5 +1,4 @@ import sys -import warnings from typing import TYPE_CHECKING, Iterator, List, Optional, Tuple, Type, Union if sys.version_info >= (3, 11): @@ -8,7 +7,6 @@ from typing_extensions import Self -from hera.shared import global_config from hera.shared._pydantic import _PYDANTIC_VERSION, FieldInfo, get_field_annotations, get_fields from hera.shared._type_util import construct_io_from_annotation, get_workflow_annotation from hera.shared.serialization import MISSING, serialize diff --git a/src/hera/workflows/script.py b/src/hera/workflows/script.py index a59e066f8..ad066380a 100644 --- a/src/hera/workflows/script.py +++ b/src/hera/workflows/script.py @@ -9,7 +9,6 @@ import inspect import sys import textwrap -import warnings from abc import abstractmethod from functools import wraps from typing import ( diff --git a/tests/test_script_annotations.py b/tests/test_script_annotations.py index 93fe49e36..cd2f033fe 100644 --- a/tests/test_script_annotations.py +++ b/tests/test_script_annotations.py @@ -64,33 +64,10 @@ def test_script_annotations_artifact_regression(module_name, global_config_fixtu _compare_workflows(workflow_old, output_old, output_new) -def test_double_default_throws_a_value_error(global_config_fixture): - """Test asserting that it is not possible to define default in the annotation and normal Python.""" +def test_parameter_default_throws_a_value_error(global_config_fixture): + """Test asserting that it is not possible to define default in the annotation.""" # GIVEN - global_config_fixture.experimental_features["suppress_parameter_default_error"] = True - - @script() - def echo_int(an_int: Annotated[int, Parameter(default=1)] = 2): - print(an_int) - - global_config_fixture.experimental_features["script_annotations"] = True - with pytest.raises(ValueError) as e: - with Workflow(generate_name="test-default-", entrypoint="my-steps") as w: - with Steps(name="my-steps"): - echo_int() - - w.to_dict() - - assert "default cannot be set via both the function parameter default and the Parameter's default" in str(e.value) - - -def test_parameter_default_without_suppression_throws_a_value_error(global_config_fixture): - """Test asserting that it is not possible to define default in the annotation and normal Python.""" - - # GIVEN - global_config_fixture.experimental_features["suppress_parameter_default_error"] = False - @script() def echo_int(an_int: Annotated[int, Parameter(default=1)]): print(an_int) @@ -103,11 +80,7 @@ def echo_int(an_int: Annotated[int, Parameter(default=1)]): w.to_dict() - assert ( - "default cannot be set via the Parameter's default, use a Python default value instead" - "You can suppress this error by setting " - 'global_config.experimental_features["suppress_parameter_default_error"] = True' - ) in str(e.value) + assert ("default cannot be set via the Parameter's default, use a Python default value instead") in str(e.value) @pytest.mark.parametrize( diff --git a/tests/workflow_decorators/steps.py b/tests/workflow_decorators/steps.py index 4e507c128..83f49124d 100644 --- a/tests/workflow_decorators/steps.py +++ b/tests/workflow_decorators/steps.py @@ -22,7 +22,7 @@ def setup() -> SetupOutput: class ConcatInput(Input): - word_a: Annotated[str, Parameter(name="word_a", default="")] + word_a: Annotated[str, Parameter(name="word_a")] = "" word_b: str