1010from vgi .ipc_utils import RecordBatchState
1111from vgi .log import Level
1212from vgi .table_in_out_function import TableInOutFunction
13- from vgi .testing import FunctionTestClient , batch
13+ from vgi .testing import TableInOutFunctionTestClient , batch
1414
1515
1616class TestPassthrough :
@@ -22,7 +22,7 @@ def test_passthrough_returns_same_data(self) -> None:
2222 class PassthroughFunction (TableInOutFunction ):
2323 pass
2424
25- with FunctionTestClient (PassthroughFunction ) as client :
25+ with TableInOutFunctionTestClient (PassthroughFunction ) as client :
2626 outputs = list (
2727 client .table_in_out_function (
2828 input = iter ([batch (x = [1 , 2 , 3 ]), batch (x = [4 , 5 ])]),
@@ -48,7 +48,7 @@ def transform(self, batch: pa.RecordBatch) -> pa.RecordBatch:
4848 doubled = pc .multiply (batch .column ("x" ), 2 )
4949 return pa .RecordBatch .from_arrays ([doubled ], schema = batch .schema )
5050
51- with FunctionTestClient (DoubleFunction ) as client :
51+ with TableInOutFunctionTestClient (DoubleFunction ) as client :
5252 outputs = list (
5353 client .table_in_out_function (input = iter ([batch (x = [1 , 2 , 3 ])]))
5454 )
@@ -63,7 +63,7 @@ class TripleFunction(TableInOutFunction):
6363 def transform (self , batch : pa .RecordBatch ) -> list [pa .RecordBatch ]:
6464 return [batch , batch , batch ]
6565
66- with FunctionTestClient (TripleFunction ) as client :
66+ with TableInOutFunctionTestClient (TripleFunction ) as client :
6767 outputs = list (client .table_in_out_function (input = iter ([batch (x = [1 , 2 ])])))
6868
6969 # Should have 3 outputs from 1 input
@@ -80,7 +80,7 @@ class RepeatFunction(TableInOutFunction):
8080 def transform (self , batch : pa .RecordBatch ) -> list [pa .RecordBatch ]:
8181 return [batch ] * self .count
8282
83- with FunctionTestClient (RepeatFunction ) as client :
83+ with TableInOutFunctionTestClient (RepeatFunction ) as client :
8484 outputs = list (
8585 client .table_in_out_function (
8686 input = iter ([batch (x = [1 ])]),
@@ -122,7 +122,7 @@ def finish(self) -> list[pa.RecordBatch]:
122122 )
123123 ]
124124
125- with FunctionTestClient (SumFunction ) as client :
125+ with TableInOutFunctionTestClient (SumFunction ) as client :
126126 outputs = list (
127127 client .table_in_out_function (
128128 input = iter ([batch (x = [1 , 2 , 3 ]), batch (x = [4 , 5 ])])
@@ -153,7 +153,7 @@ def transform(self, batch: pa.RecordBatch) -> pa.RecordBatch:
153153 def finish (self ) -> list [pa .RecordBatch ]:
154154 return self .buffer
155155
156- with FunctionTestClient (BufferFunction ) as client :
156+ with TableInOutFunctionTestClient (BufferFunction ) as client :
157157 outputs = list (
158158 client .table_in_out_function (
159159 input = iter ([batch (x = [1 , 2 ]), batch (x = [3 , 4 ])])
@@ -182,7 +182,7 @@ def transform(self, batch: pa.RecordBatch) -> pa.RecordBatch:
182182 lengths = pc .utf8_length (batch .column ("name" )) # type: ignore[call-overload]
183183 return pa .RecordBatch .from_arrays ([lengths ], schema = self .output_schema )
184184
185- with FunctionTestClient (LengthFunction ) as client :
185+ with TableInOutFunctionTestClient (LengthFunction ) as client :
186186 outputs = list (
187187 client .table_in_out_function (
188188 input = iter ([batch (name = ["hello" , "world!" ])])
@@ -213,7 +213,7 @@ def transform(self, batch: pa.RecordBatch) -> pa.RecordBatch:
213213 return self .empty_output_batch
214214 return pa .RecordBatch .from_arrays ([filtered ], schema = batch .schema )
215215
216- with FunctionTestClient (FilterOddFunction ) as client :
216+ with TableInOutFunctionTestClient (FilterOddFunction ) as client :
217217 outputs = list (
218218 client .table_in_out_function (
219219 input = iter ([batch (x = [1 , 3 , 5 ]), batch (x = [2 , 4 ])]) # odd, even
@@ -230,7 +230,7 @@ def test_finish_returns_empty_list(self) -> None:
230230 class PassthroughFunction (TableInOutFunction ):
231231 pass
232232
233- with FunctionTestClient (PassthroughFunction ) as client :
233+ with TableInOutFunctionTestClient (PassthroughFunction ) as client :
234234 outputs = list (client .table_in_out_function (input = iter ([batch (x = [1 , 2 ])])))
235235
236236 # Should only have the transform output, no finalize output
@@ -249,7 +249,7 @@ def transform(self, batch: pa.RecordBatch) -> pa.RecordBatch:
249249 self .log (Level .INFO , f"Processing { batch .num_rows } rows" )
250250 return batch
251251
252- with FunctionTestClient (LoggingFunction ) as client :
252+ with TableInOutFunctionTestClient (LoggingFunction ) as client :
253253 outputs = list (
254254 client .table_in_out_function (input = iter ([batch (x = [1 , 2 , 3 ])]))
255255 )
@@ -292,7 +292,7 @@ def finish(self) -> list[pa.RecordBatch]:
292292 )
293293 ]
294294
295- with FunctionTestClient (LoggingAggregateFunction ) as client :
295+ with TableInOutFunctionTestClient (LoggingAggregateFunction ) as client :
296296 outputs = list (
297297 client .table_in_out_function (input = iter ([batch (x = [1 , 2 , 3 ])]))
298298 )
@@ -314,7 +314,7 @@ def transform(self, batch: pa.RecordBatch) -> pa.RecordBatch:
314314 self .log (Level .INFO , f"Rows: { batch .num_rows } " )
315315 return batch
316316
317- with FunctionTestClient (MultiLogFunction ) as client :
317+ with TableInOutFunctionTestClient (MultiLogFunction ) as client :
318318 outputs = list (client .table_in_out_function (input = iter ([batch (x = [1 , 2 ])])))
319319
320320 # Should have 1 output batch
0 commit comments