Skip to content

Commit 7c5217b

Browse files
committed
refactor action tests
1 parent 3117635 commit 7c5217b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tests/orchestrator/test_chaining_orchestrator.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,19 @@ def test_orchestration_state_output(context, output_state):
3636

3737

3838
def assert_attribute_equal(expected, result, attribute):
39-
if hasattr(expected, attribute):
39+
if attribute in expected:
4040
assert expected.get(attribute) == result.get(attribute)
4141
else:
42-
assert not hasattr(result, attribute)
42+
assert attribute not in result
4343

4444

4545
def assert_actions_are_equal(expected, result):
4646
expected_actions = expected.get("actions")
4747
result_actions = result.get("actions")
4848
assert len(expected_actions) == len(result_actions)
4949
for index in range(len(expected_actions)):
50-
assert expected_actions[index][0]["functionName"] == result_actions[index][0]["functionName"]
51-
assert expected_actions[index][0]["input"] == result_actions[index][0]["input"]
52-
assert expected_actions[index][0]["actionType"] == result_actions[index][0]["actionType"]
50+
expected_action = expected_actions[index][0]
51+
result_action = result_actions[index][0]
52+
assert_attribute_equal(expected_action, result_action, "functionName")
53+
assert_attribute_equal(expected_action, result_action, "input")
54+
assert_attribute_equal(expected_action, result_action, "actionType")

0 commit comments

Comments
 (0)