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

Function test_groupby_instance

python/pathway/tests/test_common.py:4030–4054  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4028
4029
4030def test_groupby_instance():
4031 t = T(
4032 """
4033 a | b | col
4034 0 | 0 | 1
4035 0 | 0 | 2
4036 1 | 0 | 3
4037 1 | 0 | 4
4038 0 | 1 | 5
4039 0 | 1 | 6
4040 """
4041 )
4042 expected = T(
4043 """
4044 a | b | col
4045 0 | 0 | 3
4046 1 | 0 | 7
4047 0 | 1 | 11
4048 """
4049 ).with_id_from(pw.this.b, instance=pw.this.a)
4050
4051 res = t.groupby(pw.this.b, instance=pw.this.a).reduce(
4052 pw.this.a, pw.this.b, col=pw.reducers.sum(pw.this.col)
4053 )
4054 assert_table_equality(res, expected)
4055
4056
4057def test_join_ix():

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
with_id_fromMethod · 0.80
reduceMethod · 0.45
groupbyMethod · 0.45

Tested by

no test coverage detected