MCPcopy Index your code
hub / github.com/pathwaycom/pathway / test_prevnext_single_instance

Function test_prevnext_single_instance

python/pathway/tests/test_sorting.py:32–62  ·  view source on GitHub ↗

Treap built with priorities being hashes (minhash is the root, and recursively), sorted according to key column.

()

Source from the content-addressed store, hash-verified

30
31
32def test_prevnext_single_instance():
33 """Treap built with priorities being hashes (minhash is the root, and recursively),
34 sorted according to key column."""
35 nodes = T(
36 """
37 | key | instance
38 1 | 1 | 42
39 2 | 5 | 42
40 3 | 3 | 42
41 4 | 8 | 42
42 5 | 2 | 42
43 """
44 )
45 result = nodes.sort(key=nodes.key, instance=nodes.instance)
46
47 assert_table_equality(
48 result,
49 T(
50 """
51 | next | prev
52 1 | 5 |
53 2 | 4 | 3
54 3 | 2 | 5
55 4 | | 2
56 5 | 3 | 1
57 """,
58 ).select(
59 prev=nodes.pointer_from(this.prev, optional=True),
60 next=nodes.pointer_from(this.next, optional=True),
61 ),
62 )
63
64
65def test_prevnext_many_instance():

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
sortMethod · 0.80
selectMethod · 0.45
pointer_fromMethod · 0.45

Tested by

no test coverage detected