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

Function test_ix_sort_1

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

Source from the content-addressed store, hash-verified

2579
2580
2581def test_ix_sort_1():
2582 data = T(
2583 """
2584 a | t
2585 0 | 1
2586 0 | 2
2587 0 | 3
2588 1 | 1
2589 1 | 2
2590 """
2591 )
2592 data_prev_next = data.sort(key=pw.this.t, instance=pw.this.a)
2593 data_prev = data.ix(data_prev_next.prev, optional=True)
2594 data_next = data.ix(data_prev_next.next, optional=True)
2595 result = data.select(pw.this.a, pw.this.t, prev_t=data_prev.t, next_t=data_next.t)
2596 expected = T(
2597 """
2598 a | t | prev_t | next_t
2599 0 | 1 | | 2
2600 0 | 2 | 1 | 3
2601 0 | 3 | 2 |
2602 1 | 1 | | 2
2603 1 | 2 | 1 |
2604 """
2605 )
2606 assert_table_equality(result, expected)
2607
2608
2609def test_ix_sort_2():

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected