MCPcopy Create free account
hub / github.com/pathwaycom/pathway / test_python_connector_upsert_raw

Function test_python_connector_upsert_raw

python/pathway/tests/test_io.py:2422–2446  ·  view source on GitHub ↗
(tmp_path: pathlib.Path)

Source from the content-addressed store, hash-verified

2420
2421
2422def test_python_connector_upsert_raw(tmp_path: pathlib.Path):
2423 output_path = tmp_path / "output.csv"
2424
2425 class TestSubject(pw.io.python.ConnectorSubject):
2426 @property
2427 def _session_type(self) -> SessionType:
2428 return SessionType.UPSERT
2429
2430 def run(self):
2431 self._add(api.ref_scalar(0), b"one")
2432 time.sleep(5e-2)
2433 self._remove(api.ref_scalar(0), b"")
2434 time.sleep(5e-2)
2435 self._add(api.ref_scalar(0), b"two")
2436 time.sleep(5e-2)
2437 self._add(api.ref_scalar(0), b"three")
2438 self.close()
2439
2440 table = pw.io.python.read(TestSubject(), format="raw", autocommit_duration_ms=10)
2441 pw.io.csv.write(table, output_path)
2442 run()
2443
2444 result = pd.read_csv(output_path)
2445 assert len(result) == 5
2446 assert_sets_equality_from_path(output_path, {"three,1"})
2447
2448
2449def test_python_connector_upsert_remove_raw(tmp_path: pathlib.Path):

Callers

nothing calls this directly

Calls 4

runFunction · 0.90
writeMethod · 0.80
TestSubjectClass · 0.70

Tested by

no test coverage detected