MCPcopy
hub / github.com/pathwaycom/pathway / test_stream_generator_from_markdown

Function test_stream_generator_from_markdown

python/pathway/tests/test_io.py:2289–2327  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2287
2288@pytest.mark.filterwarnings("ignore:timestamps are required to be even")
2289def test_stream_generator_from_markdown():
2290 stream_generator = pw.debug.StreamGenerator()
2291 t = stream_generator.table_from_markdown(
2292 """
2293 | colA | colB | _time
2294 1 | 1 | 2 | 1
2295 5 | 2 | 3 | 1
2296 10 | 5 | 1 | 2
2297 """
2298 )
2299 on_change = mock.Mock()
2300 pw.io.subscribe(t, on_change=on_change)
2301
2302 run(persistence_config=stream_generator.persistence_config())
2303
2304 on_change.assert_has_calls(
2305 [
2306 mock.call.on_change(
2307 key=api.ref_scalar(1),
2308 row={"colA": 1, "colB": 2},
2309 time=2,
2310 is_addition=True,
2311 ),
2312 mock.call.on_change(
2313 key=api.ref_scalar(5),
2314 row={"colA": 2, "colB": 3},
2315 time=2,
2316 is_addition=True,
2317 ),
2318 mock.call.on_change(
2319 key=api.ref_scalar(10),
2320 row={"colA": 5, "colB": 1},
2321 time=4,
2322 is_addition=True,
2323 ),
2324 ],
2325 any_order=True,
2326 )
2327 assert on_change.call_count == 3
2328
2329
2330def test_stream_generator_from_markdown_with_diffs():

Callers

nothing calls this directly

Calls 5

table_from_markdownMethod · 0.95
persistence_configMethod · 0.95
runFunction · 0.90
subscribeMethod · 0.80
on_changeMethod · 0.45

Tested by

no test coverage detected