Skip to content

fix: Support primitive types for left value of ConditionSteps #2886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/sagemaker/workflow/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def to_request(self) -> RequestType:
"""Get the request structure for workflow service calls."""
return {
"Type": self.condition_type.value,
"LeftValue": self.left.expr,
"LeftValue": primitive_or_expr(self.left),
"RightValue": primitive_or_expr(self.right),
}

Expand Down
9 changes: 9 additions & 0 deletions tests/unit/sagemaker/workflow/test_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,12 @@ def test_condition_or():
},
],
}


def test_left_and_right_primitives():
cond = ConditionEquals(left=2, right=1)
assert cond.to_request() == {
"Type": "Equals",
"LeftValue": 2,
"RightValue": 1,
}