()
| 130 | |
| 131 | |
| 132 | def test_groupby(): |
| 133 | @pw.udf |
| 134 | def create_simple(a: int) -> pw.PyObjectWrapper[Simple]: |
| 135 | return pw.PyObjectWrapper(Simple(a)) |
| 136 | |
| 137 | t = pw.debug.table_from_markdown( |
| 138 | """ |
| 139 | a |
| 140 | 1 |
| 141 | 2 |
| 142 | 2 |
| 143 | 3 |
| 144 | 1 |
| 145 | """ |
| 146 | ).select(simple=create_simple(pw.this.a)) |
| 147 | |
| 148 | res = t.groupby(pw.this.simple).reduce(cnt=pw.reducers.count()) |
| 149 | |
| 150 | expected = pw.debug.table_from_markdown( |
| 151 | """ |
| 152 | cnt |
| 153 | 2 |
| 154 | 2 |
| 155 | 1 |
| 156 | """ |
| 157 | ) |
| 158 | |
| 159 | assert_table_equality_wo_index(res, expected) |
| 160 | |
| 161 | |
| 162 | def test_compute_and_print(): |
nothing calls this directly
no test coverage detected