Skip to content

Commit f744827

Browse files
staubhpPayton Staubnavinsoni
authored
fix: Support primitive types for left value of ConditionSteps (#2886)
Co-authored-by: Payton Staub <[email protected]> Co-authored-by: Navin Soni <[email protected]>
1 parent 8215dd2 commit f744827

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/sagemaker/workflow/conditions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def to_request(self) -> RequestType:
7979
"""Get the request structure for workflow service calls."""
8080
return {
8181
"Type": self.condition_type.value,
82-
"LeftValue": self.left.expr,
82+
"LeftValue": primitive_or_expr(self.left),
8383
"RightValue": primitive_or_expr(self.right),
8484
}
8585

tests/unit/sagemaker/workflow/test_conditions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,12 @@ def test_condition_or():
165165
},
166166
],
167167
}
168+
169+
170+
def test_left_and_right_primitives():
171+
cond = ConditionEquals(left=2, right=1)
172+
assert cond.to_request() == {
173+
"Type": "Equals",
174+
"LeftValue": 2,
175+
"RightValue": 1,
176+
}

0 commit comments

Comments
 (0)