From ad8927533c766b5fb9f791d26067b9be2db0975e Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Tue, 14 May 2024 16:53:33 -0400 Subject: [PATCH] Test Pipeline._prepare_component_input_data() --- test/core/pipeline/test_pipeline.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/core/pipeline/test_pipeline.py b/test/core/pipeline/test_pipeline.py index 9d54392392..5c619d9fd8 100644 --- a/test/core/pipeline/test_pipeline.py +++ b/test/core/pipeline/test_pipeline.py @@ -1073,3 +1073,17 @@ def test__init_inputs_state(): "not_a_component": "some input data", } assert id(questions) != id(res["prompt_builder"]["questions"]) + + +def test__prepare_component_input_data(): + MockComponent = component_class("MockComponent", input_types={"x": List[str], "y": str}) + pipe = Pipeline() + pipe.add_component("first_mock", MockComponent()) + pipe.add_component("second_mock", MockComponent()) + + res = pipe._prepare_component_input_data({"x": ["some data"], "y": "some other data"}) + assert res == { + "first_mock": {"x": ["some data"], "y": "some other data"}, + "second_mock": {"x": ["some data"], "y": "some other data"}, + } + assert id(res["first_mock"]["x"]) != id(res["second_mock"]["x"])