From 6c48fe9e6b5829e1e981ddfc3dd66e3f93a0bf49 Mon Sep 17 00:00:00 2001 From: jmtts <46958876+jmtts@users.noreply.github.com> Date: Thu, 4 Sep 2025 14:10:02 +0200 Subject: [PATCH] Test postprocessor_slot usage --- tests/test_ask_custom.py | 19 +++++++++++++++++++ werk24/models/v2/asks.py | 7 ++++++- werk24/models/v2/enums.py | 10 ++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/test_ask_custom.py diff --git a/tests/test_ask_custom.py b/tests/test_ask_custom.py new file mode 100644 index 00000000..3da31064 --- /dev/null +++ b/tests/test_ask_custom.py @@ -0,0 +1,19 @@ +import pytest + +from werk24 import AskCustom, PostprocessorSlot + + +def test_postprocessor_slot_default_none(): + ask = AskCustom(custom_id="foo") + assert ask.postprocessor_slot is None + + +def test_postprocessor_slot_enum_value(): + ask = AskCustom(custom_id="foo", postprocessor_slot=PostprocessorSlot.GREEN) + assert ask.postprocessor_slot == PostprocessorSlot.GREEN + + +def test_postprocessor_slot_invalid_value(): + with pytest.raises(ValueError): + AskCustom(custom_id="foo", postprocessor_slot="red") + diff --git a/werk24/models/v2/asks.py b/werk24/models/v2/asks.py index 770fd8d7..dc7f2b86 100644 --- a/werk24/models/v2/asks.py +++ b/werk24/models/v2/asks.py @@ -4,7 +4,7 @@ from pydantic import BaseModel, Field from werk24.models.v1.ask import W24Ask -from werk24.models.v2.enums import AskType, ThumbnailFileFormat +from werk24.models.v2.enums import AskType, ThumbnailFileFormat, PostprocessorSlot from werk24.models.v2.models import RedactionKeyword @@ -32,6 +32,8 @@ class AskCustom(AskV2): ---------- - custom_id (str): The ID of the custom output to request. - config (Dict[str, Any]): Configuration options for the custom output. + - postprocessor_slot (Optional[PostprocessorSlot]): The post-processing system to + use for this request. """ ask_type: Literal[AskType.CUSTOM] = AskType.CUSTOM @@ -39,6 +41,9 @@ class AskCustom(AskV2): config: Dict[str, Any] = Field( {}, description="Configuration options for the custom output." ) + postprocessor_slot: Optional[PostprocessorSlot] = Field( + None, description="Select which postprocessing system to use." + ) class AskFeatures(AskV2): diff --git a/werk24/models/v2/enums.py b/werk24/models/v2/enums.py index e4da1ce0..62bbc8b6 100644 --- a/werk24/models/v2/enums.py +++ b/werk24/models/v2/enums.py @@ -1394,6 +1394,16 @@ class ThumbnailFileFormat(str, Enum): """The output format is PNG.""" +class PostprocessorSlot(str, Enum): + """Enumeration for available postprocessor systems.""" + + GREEN = "GREEN" + """Use the green postprocessing system.""" + + BLUE = "BLUE" + """Use the blue postprocessing system.""" + + class PrimaryProcessType(str, Enum): CUTTING = "CUTTING" TURNING = "TURNING"