MCPcopy
hub / github.com/pathwaycom/pathway / test_groupby

Function test_groupby

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

Source from the content-addressed store, hash-verified

130
131
132def 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
162def test_compute_and_print():

Callers

nothing calls this directly

Calls 6

create_simpleFunction · 0.85
table_from_markdownMethod · 0.80
countMethod · 0.80
selectMethod · 0.45
reduceMethod · 0.45
groupbyMethod · 0.45

Tested by

no test coverage detected