()
| 33 | |
| 34 | |
| 35 | def 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 |
nothing calls this directly
no test coverage detected