@@ -35,8 +35,14 @@ async def test_simple_pipeline_two_components() -> None:
3535 pipe = Pipeline ()
3636 component_a = ComponentNoParam ()
3737 component_b = ComponentNoParam ()
38- pipe .add_component ("a" , component_a )
39- pipe .add_component ("b" , component_b )
38+ pipe .add_component (
39+ component_a ,
40+ "a" ,
41+ )
42+ pipe .add_component (
43+ component_b ,
44+ "b" ,
45+ )
4046 pipe .connect ("a" , "b" , {})
4147 with mock .patch (
4248 "tests.unit.experimental.pipeline.test_pipeline.ComponentNoParam.run"
@@ -57,8 +63,14 @@ async def test_pipeline_parameter_propagation() -> None:
5763 pipe = Pipeline ()
5864 component_a = ComponentPassThrough ()
5965 component_b = ComponentPassThrough ()
60- pipe .add_component ("a" , component_a )
61- pipe .add_component ("b" , component_b )
66+ pipe .add_component (
67+ component_a ,
68+ "a" ,
69+ )
70+ pipe .add_component (
71+ component_b ,
72+ "b" ,
73+ )
6274 # first component output product goes to second component input number1
6375 pipe .connect (
6476 "a" ,
@@ -90,9 +102,15 @@ async def test_pipeline_branches() -> None:
90102 component_c = AsyncMock (spec = Component )
91103 component_c .run = AsyncMock (return_value = {})
92104
93- pipe .add_component ("a" , component_a )
94- pipe .add_component ("b" , component_b )
95- pipe .add_component ("c" , component_c )
105+ pipe .add_component (
106+ component_a ,
107+ "a" ,
108+ )
109+ pipe .add_component (
110+ component_b ,
111+ "b" ,
112+ )
113+ pipe .add_component (component_c , "c" )
96114 pipe .connect ("a" , "b" )
97115 pipe .connect ("a" , "c" )
98116 res = await pipe .run ({})
@@ -110,9 +128,15 @@ async def test_pipeline_aggregation() -> None:
110128 component_c = AsyncMock (spec = Component )
111129 component_c .run = AsyncMock (return_value = {})
112130
113- pipe .add_component ("a" , component_a )
114- pipe .add_component ("b" , component_b )
115- pipe .add_component ("c" , component_c )
131+ pipe .add_component (
132+ component_a ,
133+ "a" ,
134+ )
135+ pipe .add_component (
136+ component_b ,
137+ "b" ,
138+ )
139+ pipe .add_component (component_c , "c" )
116140 pipe .connect ("a" , "c" )
117141 pipe .connect ("b" , "c" )
118142 res = await pipe .run ({})
@@ -124,8 +148,14 @@ async def test_pipeline_missing_param_on_init() -> None:
124148 pipe = Pipeline ()
125149 component_a = ComponentAdd ()
126150 component_b = ComponentAdd ()
127- pipe .add_component ("a" , component_a )
128- pipe .add_component ("b" , component_b )
151+ pipe .add_component (
152+ component_a ,
153+ "a" ,
154+ )
155+ pipe .add_component (
156+ component_b ,
157+ "b" ,
158+ )
129159 pipe .connect ("a" , "b" , {"number1" : "a.result" })
130160 with pytest .raises (PipelineDefinitionError ) as excinfo :
131161 await pipe .run ({"a" : {"number1" : 1 }})
@@ -140,8 +170,14 @@ async def test_pipeline_missing_param_on_connect() -> None:
140170 pipe = Pipeline ()
141171 component_a = ComponentAdd ()
142172 component_b = ComponentAdd ()
143- pipe .add_component ("a" , component_a )
144- pipe .add_component ("b" , component_b )
173+ pipe .add_component (
174+ component_a ,
175+ "a" ,
176+ )
177+ pipe .add_component (
178+ component_b ,
179+ "b" ,
180+ )
145181 pipe .connect ("a" , "b" , {"number1" : "a.result" })
146182 with pytest .raises (PipelineDefinitionError ) as excinfo :
147183 await pipe .run ({"a" : {"number1" : 1 , "number2" : 2 }})
@@ -156,8 +192,14 @@ async def test_pipeline_with_default_params() -> None:
156192 pipe = Pipeline ()
157193 component_a = ComponentAdd ()
158194 component_b = ComponentMultiply ()
159- pipe .add_component ("a" , component_a )
160- pipe .add_component ("b" , component_b )
195+ pipe .add_component (
196+ component_a ,
197+ "a" ,
198+ )
199+ pipe .add_component (
200+ component_b ,
201+ "b" ,
202+ )
161203 pipe .connect ("a" , "b" , {"number1" : "a.result" })
162204 res = await pipe .run ({"a" : {"number1" : 1 , "number2" : 2 }})
163205 assert res == {"b" : {"result" : 6 }} # (1+2)*2
@@ -168,8 +210,14 @@ async def test_pipeline_cycle() -> None:
168210 pipe = Pipeline ()
169211 component_a = ComponentNoParam ()
170212 component_b = ComponentNoParam ()
171- pipe .add_component ("a" , component_a )
172- pipe .add_component ("b" , component_b )
213+ pipe .add_component (
214+ component_a ,
215+ "a" ,
216+ )
217+ pipe .add_component (
218+ component_b ,
219+ "b" ,
220+ )
173221 pipe .connect ("a" , "b" , {})
174222 with pytest .raises (PipelineDefinitionError ) as excinfo :
175223 pipe .connect ("b" , "a" , {})
@@ -181,8 +229,14 @@ async def test_pipeline_wrong_component_name() -> None:
181229 pipe = Pipeline ()
182230 component_a = ComponentNoParam ()
183231 component_b = ComponentNoParam ()
184- pipe .add_component ("a" , component_a )
185- pipe .add_component ("b" , component_b )
232+ pipe .add_component (
233+ component_a ,
234+ "a" ,
235+ )
236+ pipe .add_component (
237+ component_b ,
238+ "b" ,
239+ )
186240 with pytest .raises (PipelineDefinitionError ) as excinfo :
187241 pipe .connect ("a" , "c" , {})
188242 assert "a or c not in the Pipeline" in str (excinfo .value )
0 commit comments