Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def value_to_forest(field: ActionField, value: Any) -> Any:

elif field["type"] == ActionFieldType.COLLECTION and value:
value = cast(CompositeIdAlias, value)
return "|".join(value)
return "|".join([str(v) for v in value])

elif field["type"] == ActionFieldType.FILE and value:
return ForestValueConverter._make_data_uri(value)
Expand Down
24 changes: 24 additions & 0 deletions src/agent_toolkit/tests/utils/forest_schema/test_action_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,30 @@ def test_should_transform_multi_pk_into_composite(self):
"1|2",
)

def test_should_parse_correctly_pks_when_they_are_integer(self):
self.assertEqual(
ForestValueConverter.value_to_forest(
{
"type": ActionFieldType.COLLECTION,
"watch_changes": False,
"label": "test_enum",
},
[1],
),
"1",
)
self.assertEqual(
ForestValueConverter.value_to_forest(
{
"type": ActionFieldType.COLLECTION,
"watch_changes": False,
"label": "test_enum",
},
[1, 2],
),
"1|2",
)

def test_should_transform_file_into_datauri(self):
self.assertEqual(
ForestValueConverter.value_to_forest(
Expand Down
Loading