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

Function test_py_object_simple

python/pathway/tests/test_py_object_wrapper.py:35–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34
35def test_py_object_simple():
36
37 @pw.udf
38 def create_py_object(a: int) -> pw.PyObjectWrapper[Simple]:
39 return pw.PyObjectWrapper(Simple(a))
40
41 @pw.udf
42 def use_py_object(a: int, b: pw.PyObjectWrapper[Simple]) -> int:
43 return b.value.add(a)
44
45 t = pw.debug.table_from_markdown(
46 """
47 a
48 1
49 2
50 3
51 """
52 ).with_columns(b=create_py_object(pw.this.a))
53
54 res = t.select(res=use_py_object(pw.this.a, pw.this.b))
55
56 expected = pw.debug.table_from_markdown(
57 """
58 res
59 2
60 4
61 6
62 """
63 )
64 assert_table_equality(res, expected)
65
66
67@dataclass

Callers

nothing calls this directly

Calls 5

create_py_objectFunction · 0.85
use_py_objectFunction · 0.85
with_columnsMethod · 0.80
table_from_markdownMethod · 0.80
selectMethod · 0.45

Tested by

no test coverage detected