(tmp_path)
| 333 | |
| 334 | |
| 335 | def test_cache(tmp_path): |
| 336 | t = pw.debug.table_from_markdown( |
| 337 | """ |
| 338 | a |
| 339 | 1 |
| 340 | 2 |
| 341 | 3 |
| 342 | 2 |
| 343 | """ |
| 344 | ) |
| 345 | |
| 346 | @pw.udf(cache_strategy=pw.udfs.DiskCache()) |
| 347 | def f(a: int) -> pw.PyObjectWrapper: |
| 348 | return pw.PyObjectWrapper(a) |
| 349 | |
| 350 | @pw.udf |
| 351 | def g(a: pw.PyObjectWrapper) -> int: |
| 352 | return a.value |
| 353 | |
| 354 | res = t.select(a=g(f(pw.this.a))) |
| 355 | persistence_config = pw.persistence.Config( |
| 356 | pw.persistence.Backend.filesystem(tmp_path), |
| 357 | persistence_mode=pw.PersistenceMode.UDF_CACHING, |
| 358 | ) |
| 359 | assert_table_equality(t, res, persistence_config=persistence_config) |
nothing calls this directly
no test coverage detected