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

Function test_python_tuple_sorting

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

Source from the content-addressed store, hash-verified

6709
6710
6711def test_python_tuple_sorting():
6712 t = T(
6713 """
6714 a | b | c
6715 1 | 3 | 2
6716 2 | 4 | 1
6717 3 | 3 | 6
6718 4 | 2 | 8
6719 5 | 5 | 6
6720 6 | 1 | 4
6721 7 | 2 | 2
6722 8 | 3 | 3
6723 """
6724 )
6725 sorted = t.sort(key=(pw.this.b, pw.this.c))
6726 result = t.select(pw.this.a, prev_a=t.ix(sorted.prev, optional=True).a)
6727 expected = T(
6728 """
6729 a | prev_a
6730 1 | 4
6731 2 | 3
6732 3 | 8
6733 4 | 7
6734 5 | 2
6735 6 |
6736 7 | 6
6737 8 | 1
6738 """
6739 )
6740 assert_table_equality(result, expected)
6741
6742
6743def test_table_to_pandas_with_id():

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
sortMethod · 0.80
selectMethod · 0.45
ixMethod · 0.45

Tested by

no test coverage detected