(tmp_path: pathlib.Path)
| 2420 | |
| 2421 | |
| 2422 | def 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 | |
| 2449 | def test_python_connector_upsert_remove_raw(tmp_path: pathlib.Path): |
nothing calls this directly
no test coverage detected