Skip to content

Commit

Permalink
Remove builtins.hash from WorkflowDefinitionUpsert
Browse files Browse the repository at this point in the history
  • Loading branch information
haakonvt committed Dec 4, 2023
1 parent 6529464 commit 0cf4124
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cognite/client/data_classes/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ def load(cls, data: dict[str, Any]) -> FunctionTaskOutput:

def dump(self, camel_case: bool = True) -> dict[str, Any]:
return {
("callId" if camel_case else "call_id"): self.call_id,
("functionId" if camel_case else "function_id"): self.function_id,
"callId" if camel_case else "call_id": self.call_id,
"functionId" if camel_case else "function_id": self.function_id,
"response": self.response,
}

Expand Down Expand Up @@ -629,7 +629,6 @@ def __init__(
tasks: list[WorkflowTask],
description: str | None,
) -> None:
self.hash = hash
self.tasks = tasks
self.description = description

Expand Down
12 changes: 12 additions & 0 deletions tests/tests_unit/test_data_classes/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
FunctionTaskOutput,
FunctionTaskParameters,
TransformationTaskOutput,
TransformationTaskParameters,
WorkflowDefinition,
WorkflowDefinitionUpsert,
WorkflowExecutionDetailed,
WorkflowIds,
WorkflowTask,
Expand All @@ -19,6 +22,15 @@
)


class TestWorkFlowDefinitions:
def test_upsert_variant_doesnt_accept_hash(self):
task = WorkflowTask(external_id="foo", parameters=TransformationTaskParameters(external_id="something"))
WorkflowDefinition(tasks=[task], description="desc", hash_="very-random")

with pytest.raises(TypeError, match="unexpected keyword argument 'hash_'$"):
WorkflowDefinitionUpsert(tasks=[task], description="desc", hash_="very-random")


class TestWorkflowTaskOutput:
@pytest.mark.parametrize(
["output", "expected"],
Expand Down

0 comments on commit 0cf4124

Please sign in to comment.