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

Function _assert_diffs_match

python/pathway/tests/test_persistence_iterate.py:320–337  ·  view source on GitHub ↗

Assert the CSV output matches expected diffs exactly. The CSV has columns like (event_time, data, chunk_start, time, diff). We consolidate, drop time, and combine remaining columns into strings. Diffs must be exactly +1 or -1.

(output_path: pathlib.Path, expected: set)

Source from the content-addressed store, hash-verified

318
319
320def _assert_diffs_match(output_path: pathlib.Path, expected: set) -> None:
321 """Assert the CSV output matches expected diffs exactly.
322
323 The CSV has columns like (event_time, data, chunk_start, time, diff).
324 We consolidate, drop time, and combine remaining columns into strings.
325 Diffs must be exactly +1 or -1.
326 """
327 _assert_diffs_are_unit(output_path)
328 try:
329 df = consolidate(pd.read_csv(output_path))
330 except pd.errors.EmptyDataError:
331 assert expected == set(), f"Expected {expected} but output was empty"
332 return
333
334 actual = set(combine_columns(df))
335 assert (
336 actual == expected
337 ), f"Diffs mismatch:\n actual: {sorted(actual)}\n expected: {sorted(expected)}"
338
339
340def _compute_chunk_assignments(events: dict) -> dict:

Calls 3

consolidateFunction · 0.90
combine_columnsFunction · 0.90
_assert_diffs_are_unitFunction · 0.85

Tested by

no test coverage detected