From 2147dfa11748799b1d4c353ad4237a0dafb88391 Mon Sep 17 00:00:00 2001 From: Nathan Perkins Date: Thu, 24 Aug 2023 21:07:24 +1000 Subject: [PATCH] add in unknown parsing for WFTypes --- darwin/future/data_objects/workflow.py | 5 +++++ darwin/future/tests/meta/queries/test_stage.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/darwin/future/data_objects/workflow.py b/darwin/future/data_objects/workflow.py index 3fd1e567f..2691627bc 100644 --- a/darwin/future/data_objects/workflow.py +++ b/darwin/future/data_objects/workflow.py @@ -87,6 +87,11 @@ class WFType(Enum): ARCHIVE = "archive" CONSENSUS_TEST = "consensus_test" CONSENSUS_ENTRYPOINT = "consensus_entrypoint" + UNKNOWN = "unknown" + + @classmethod + def _missing_(cls, value: str) -> "WFType": + return WFType.UNKNOWN class WFUser(DefaultDarwin): diff --git a/darwin/future/tests/meta/queries/test_stage.py b/darwin/future/tests/meta/queries/test_stage.py index c5e8e424a..9dfdc20e6 100644 --- a/darwin/future/tests/meta/queries/test_stage.py +++ b/darwin/future/tests/meta/queries/test_stage.py @@ -35,6 +35,11 @@ def multi_stage_workflow_object(base_single_workflow_object: dict) -> dict: return base_single_workflow_object +def test_WFTypes_accept_unknonwn() -> None: + assert WFType("unknown") == WFType.UNKNOWN + assert WFType("test") == WFType.UNKNOWN + + def test_stage_collects_basic( filled_query: StageQuery, base_single_workflow_object: dict, base_workflow_meta: WorkflowMeta ) -> None: