MCPcopy Index your code
hub / github.com/pathwaycom/pathway / test_simple

Function test_simple

python/pathway/tests/test_async_transformer.py:34–68  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

32
33
34def test_simple(monkeypatch):
35 monkeypatch.delenv("PATHWAY_PERSISTENT_STORAGE", raising=False)
36
37 class OutputSchema(pw.Schema):
38 ret: int
39
40 class TestAsyncTransformer(pw.AsyncTransformer, output_schema=OutputSchema):
41 async def invoke(self, value: int) -> dict[str, Any]:
42 await asyncio.sleep(random.uniform(0, 0.1))
43 return dict(ret=value + 1)
44
45 input_table = T(
46 """
47 | value
48 1 | 1
49 2 | 2
50 3 | 3
51 """
52 )
53
54 result = TestAsyncTransformer(input_table=input_table).successful
55
56 assert result._universe.is_subset_of(input_table._universe)
57
58 assert_table_equality(
59 result,
60 T(
61 """
62 | ret
63 1 | 2
64 2 | 3
65 3 | 4
66 """
67 ),
68 )
69
70
71def test_file_io(monkeypatch, tmp_path: pathlib.Path):

Callers

nothing calls this directly

Calls 3

TFunction · 0.90
is_subset_ofMethod · 0.80

Tested by

no test coverage detected