@@ -181,23 +181,32 @@ def powers_in_trange(a, exponent):
181181 }
182182
183183 inputs = {"a" : 1 , "b" : 2 , "exponent" : 3 }
184- plan = net .compile (outputs = None , inputs = inputs .keys ())
185- sol = plan .execute (named_inputs = inputs )
184+ outputs = None
185+ plan = net .compile (outputs = outputs , inputs = inputs .keys ())
186+ sol = plan .execute (inputs )
187+ assert sol == exp
188+ sol = plan .execute (inputs , outputs )
186189 assert sol == exp
187190
188191 # get specific outputs
189192 exp = {"sum_ab_times_b" : 6 }
190- plan = net .compile (outputs = ["sum_ab_times_b" ], inputs = list (inputs ))
191- sol = plan .execute (named_inputs = inputs )
193+ outputs = ["sum_ab_times_b" ]
194+ plan = net .compile (outputs = outputs , inputs = list (inputs ))
195+ sol = plan .execute (inputs )
196+ assert sol == exp
197+ sol = plan .execute (inputs , outputs )
192198 assert sol == exp
193199
194200 # start with inputs already computed
195201 inputs = {"sum_ab" : 1 , "b" : 2 , "exponent" : 3 }
196202 exp = {"sum_ab_times_b" : 2 }
197- plan = net .compile (outputs = ["sum_ab_times_b" ], inputs = inputs )
203+ outputs = ["sum_ab_times_b" ]
204+ plan = net .compile (outputs = outputs , inputs = inputs )
198205 with pytest .raises (ValueError , match = r"Plan needs more inputs:" ):
199206 sol = plan .execute (named_inputs = {"sum_ab" : 1 })
200- sol = plan .execute (named_inputs = inputs )
207+ sol = plan .execute (inputs )
208+ assert sol == exp
209+ sol = plan .execute (inputs , outputs )
201210 assert sol == exp
202211
203212
@@ -790,8 +799,9 @@ def add(a=0, b=0):
790799 == "NetworkOperation('t', needs=[optional('a')], provides=['sum1'])"
791800 )
792801
793- with pytest .raises (ValueError , match = "Impossible outputs:" ):
794- compose ("t" , * ops , needs = "bb" , provides = ["sum2" ])
802+ netop = compose ("t" , * ops , needs = "bb" , provides = ["sum2" ])
803+ with pytest .raises (ValueError , match = "Unsolvable graph:" ):
804+ netop .compute ({'bb' : 11 })
795805
796806 ## Narrow by unknown needs
797807 #
@@ -845,7 +855,7 @@ def test_sideffect_no_real_data(exemethod, netop_sideffect1: NetworkOperation):
845855 with pytest .raises (ValueError , match = "Unsolvable graph" ):
846856 assert graph .compute (inp , recompile = True )
847857
848- with pytest .raises (ValueError , match = "Impossible output " ):
858+ with pytest .raises (ValueError , match = "Unsolvable graph " ):
849859 graph .compute (inp , ["box" , sideffect ("b" )])
850860
851861 with pytest .raises (ValueError , match = "Plan needs more inputs" ):
@@ -859,7 +869,7 @@ def test_sideffect_no_real_data(exemethod, netop_sideffect1: NetworkOperation):
859869 assert sol == {"box" : [1 , 2 , 3 ], sideffect ("a" ): True }
860870 #
861871 # bad, not asked the out-sideffect
862- with pytest .raises (ValueError , match = "Impossible output " ):
872+ with pytest .raises (ValueError , match = "Unsolvable graph " ):
863873 sol = graph .compute ({"box" : [0 ], sideffect ("a" ): True }, "box" )
864874 #
865875 # ok, asked the 1st out-sideffect
0 commit comments