Skip to content

Commit 4119297

Browse files
committed
renaming cleanups
1 parent 1b0aa94 commit 4119297

12 files changed

Lines changed: 125 additions & 117 deletions

‎.beads/issues.jsonl‎

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ wheels/
1313
mypy-reports/
1414
mypy-html-report/
1515

16+
# Beads
17+
.beads/
18+
1619
# Coverage artifacts
1720
.coverage
1821
.coverage.*

‎tests/table/generator/conftest.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from vgi.client import Client, ClientError
1111
from vgi.log import Message
1212
from vgi.table_function import TableFunctionGenerator
13-
from vgi.testing import FunctionTestClientError, TableFunctionTestClient
13+
from vgi.testing import TableFunctionTestClient, TableInOutFunctionTestClientError
1414

1515
# Type alias for the runner function
1616
TableFunctionRunner = Callable[
@@ -85,5 +85,5 @@ def run_function() -> TableFunctionRunner:
8585

8686

8787
# Re-export error types for convenience
88-
InProcessError = FunctionTestClientError
88+
InProcessError = TableInOutFunctionTestClientError
8989
SubprocessError = ClientError

‎tests/table/generator/test_exception_function.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from vgi.arguments import Arguments
77
from vgi.client import Client, ClientError
88
from vgi.examples.table import GeneratorExceptionFunction
9-
from vgi.testing import FunctionTestClientError, TableFunctionTestClient
9+
from vgi.testing import TableFunctionTestClient, TableInOutFunctionTestClientError
1010

1111

1212
class TestGeneratorExceptionFunctionInProcess:
@@ -16,7 +16,7 @@ def test_raises_exception_after_batches(self) -> None:
1616
"""Function should raise exception after specified batches."""
1717
with (
1818
TableFunctionTestClient(GeneratorExceptionFunction) as client,
19-
pytest.raises(FunctionTestClientError) as exc_info,
19+
pytest.raises(TableInOutFunctionTestClientError) as exc_info,
2020
):
2121
list(client.table_function(arguments=Arguments(positional=(pa.scalar(3),))))
2222

@@ -26,7 +26,7 @@ def test_raises_exception_immediately(self) -> None:
2626
"""Function with fail_after=0 should raise immediately."""
2727
with (
2828
TableFunctionTestClient(GeneratorExceptionFunction) as client,
29-
pytest.raises(FunctionTestClientError) as exc_info,
29+
pytest.raises(TableInOutFunctionTestClientError) as exc_info,
3030
):
3131
list(client.table_function(arguments=Arguments(positional=(pa.scalar(0),))))
3232

@@ -41,7 +41,7 @@ def test_outputs_batches_before_failure(self) -> None:
4141
arguments=Arguments(positional=(pa.scalar(3),))
4242
):
4343
outputs.append(batch)
44-
except FunctionTestClientError:
44+
except TableInOutFunctionTestClientError:
4545
pass
4646

4747
# Should have 3 batches before failure

‎tests/table/test_function.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
TableCardinality,
1515
TableFunctionGenerator,
1616
)
17-
from vgi.testing import FunctionTestClientError, TableFunctionTestClient
17+
from vgi.testing import TableFunctionTestClient, TableInOutFunctionTestClientError
1818

1919

2020
class TestTableFunctionGeneratorProtocol:
@@ -127,7 +127,7 @@ def teardown(self) -> None:
127127

128128
with (
129129
TableFunctionTestClient(ExceptionFunction) as client,
130-
pytest.raises(FunctionTestClientError),
130+
pytest.raises(TableInOutFunctionTestClientError),
131131
):
132132
list(client.table_function())
133133

@@ -173,7 +173,7 @@ def process(self) -> OutputGenerator:
173173

174174
with (
175175
TableFunctionTestClient(InvalidSchemaFunction) as client,
176-
pytest.raises(FunctionTestClientError) as exc_info,
176+
pytest.raises(TableInOutFunctionTestClientError) as exc_info,
177177
):
178178
list(client.table_function())
179179

‎tests/table_in_out/test_function.py‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from vgi.ipc_utils import RecordBatchState
1111
from vgi.log import Level
1212
from vgi.table_in_out_function import TableInOutFunction
13-
from vgi.testing import FunctionTestClient, batch
13+
from vgi.testing import TableInOutFunctionTestClient, batch
1414

1515

1616
class 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

‎tests/table_in_out/test_streaming_decorator.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
streaming,
1313
)
1414
from vgi.log import Level, Message
15-
from vgi.testing import FunctionTestClient, batch
15+
from vgi.testing import TableInOutFunctionTestClient, batch
1616

1717

1818
class EchoStreamingFunction(TableInOutGenerator):
@@ -97,7 +97,7 @@ class TestStreamingDecorator:
9797

9898
def test_basic_echo(self) -> None:
9999
"""@streaming decorated function should echo batches."""
100-
with FunctionTestClient(EchoStreamingFunction) as client:
100+
with TableInOutFunctionTestClient(EchoStreamingFunction) as client:
101101
outputs = list(
102102
client.table_in_out_function(input=iter([batch(x=[1, 2, 3])]))
103103
)
@@ -107,7 +107,7 @@ def test_basic_echo(self) -> None:
107107

108108
def test_multiple_batches(self) -> None:
109109
"""@streaming should handle multiple input batches."""
110-
with FunctionTestClient(EchoStreamingFunction) as client:
110+
with TableInOutFunctionTestClient(EchoStreamingFunction) as client:
111111
outputs = list(
112112
client.table_in_out_function(
113113
input=iter([batch(x=[1]), batch(x=[2]), batch(x=[3])])
@@ -121,14 +121,14 @@ def test_multiple_batches(self) -> None:
121121

122122
def test_empty_input(self) -> None:
123123
"""@streaming should handle empty input."""
124-
with FunctionTestClient(EchoStreamingFunction) as client:
124+
with TableInOutFunctionTestClient(EchoStreamingFunction) as client:
125125
outputs = list(client.table_in_out_function(input=iter([])))
126126

127127
assert len(outputs) == 0
128128

129129
def test_state_accumulation(self) -> None:
130130
"""@streaming should allow state accumulation."""
131-
with FunctionTestClient(CountingStreamingFunction) as client:
131+
with TableInOutFunctionTestClient(CountingStreamingFunction) as client:
132132
outputs = list(
133133
client.table_in_out_function(
134134
input=iter([batch(x=[1]), batch(x=[2]), batch(x=[3])])
@@ -139,7 +139,7 @@ def test_state_accumulation(self) -> None:
139139

140140
def test_accumulation_with_finalize(self) -> None:
141141
"""@streaming should work with finalize() for aggregations."""
142-
with FunctionTestClient(AccumulatingStreamingFunction) as client:
142+
with TableInOutFunctionTestClient(AccumulatingStreamingFunction) as client:
143143
outputs = list(
144144
client.table_in_out_function(
145145
input=iter([batch(x=[1, 2, 3]), batch(x=[4, 5])])
@@ -154,7 +154,7 @@ def test_accumulation_with_finalize(self) -> None:
154154

155155
def test_logging(self) -> None:
156156
"""@streaming should support yielding log messages."""
157-
with FunctionTestClient(LoggingStreamingFunction) as client:
157+
with TableInOutFunctionTestClient(LoggingStreamingFunction) as client:
158158
outputs = list(
159159
client.table_in_out_function(input=iter([batch(x=[1, 2, 3])]))
160160
)
@@ -186,12 +186,12 @@ def process(self, b: pa.RecordBatch) -> OutputGenerator:
186186
input_batches_1 = [batch(x=[1, 2]), batch(x=[3, 4])]
187187
input_batches_2 = [batch(x=[1, 2]), batch(x=[3, 4])]
188188

189-
with FunctionTestClient(ManualEcho) as client:
189+
with TableInOutFunctionTestClient(ManualEcho) as client:
190190
manual_outputs = list(
191191
client.table_in_out_function(input=iter(input_batches_1))
192192
)
193193

194-
with FunctionTestClient(EchoStreamingFunction) as client:
194+
with TableInOutFunctionTestClient(EchoStreamingFunction) as client:
195195
streaming_outputs = list(
196196
client.table_in_out_function(input=iter(input_batches_2))
197197
)

0 commit comments

Comments
 (0)