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

Function test_cache

python/pathway/tests/test_py_object_wrapper.py:335–359  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

333
334
335def 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)

Callers

nothing calls this directly

Calls 5

table_from_markdownMethod · 0.80
filesystemMethod · 0.80
gFunction · 0.70
fFunction · 0.70
selectMethod · 0.45

Tested by

no test coverage detected