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

Function test_tuple_reducer_consistency

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

Source from the content-addressed store, hash-verified

5918
5919
5920def test_tuple_reducer_consistency():
5921 left = T(
5922 """
5923 pet | owner | age
5924 dog | Bob | 10
5925 cat | Alice | 9
5926 cat | Alice | 8
5927 dog | Bob | 7
5928 foo | Charlie | 6
5929 """
5930 )
5931
5932 left_res = left.reduce(
5933 pet=pw.reducers.tuple(left.pet),
5934 owner=pw.reducers.tuple(left.owner),
5935 age=pw.reducers.tuple(left.age),
5936 )
5937
5938 t2 = left_res.select(
5939 pet=pw.this.pet.get(3), owner=pw.this.owner.get(3), age=pw.this.age.get(3)
5940 )
5941 print(t2.schema)
5942
5943 joined = left.join(
5944 t2,
5945 left.pet == t2.pet,
5946 left.owner == t2.owner,
5947 left.age == t2.age,
5948 ).reduce(cnt=pw.reducers.count())
5949
5950 assert_table_equality_wo_index(
5951 joined,
5952 T(
5953 """
5954 cnt
5955 1
5956 """
5957 ),
5958 )
5959
5960
5961@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 6

TFunction · 0.90
countMethod · 0.80
reduceMethod · 0.45
selectMethod · 0.45
getMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected