Skip to content

Commit

Permalink
Add sede_with_list_output_type_in_pipeline unit test (#8196)
Browse files Browse the repository at this point in the history
  • Loading branch information
vblagoje committed Aug 13, 2024
1 parent 1284ca2 commit 3318d89
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/components/converters/test_output_adapter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
#
# SPDX-License-Identifier: Apache-2.0

from typing import List
import json

import pytest
Expand Down Expand Up @@ -129,6 +131,17 @@ def test_sede_with_multiple_custom_filters(self):
# invoke the custom filter to check if it is deserialized correctly
assert deserialized_adapter.custom_filters["custom_filter"]("test") == "TEST"

def test_sede_with_list_output_type_in_pipeline(self):
pipe = Pipeline()
pipe.add_component("adapter", OutputAdapter(template="{{ test }}", output_type=List[str]))
serialized_pipe = pipe.dumps()

# we serialize the pipeline and check if the output type is serialized correctly (as typing.List[str])
assert "typing.List[str]" in serialized_pipe

deserialized_pipe = Pipeline.loads(serialized_pipe)
assert deserialized_pipe.get_component("adapter").output_type == List[str]

def test_output_adapter_from_dict_custom_filters_none(self):
component = OutputAdapter.from_dict(
data={
Expand Down

0 comments on commit 3318d89

Please sign in to comment.