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

Function test_prevnext_many_instance

python/pathway/tests/test_sorting.py:65–105  ·  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

63
64
65def test_prevnext_many_instance():
66 """Treap built with priorities being hashes (minhash is the root, and recursively),
67 sorted according to key column."""
68 nodes = T(
69 """
70 | key | instance
71 1 | 1 | 42
72 2 | 1 | 28
73 3 | 5 | 42
74 4 | 5 | 28
75 5 | 3 | 42
76 6 | 3 | 28
77 7 | 8 | 42
78 8 | 8 | 28
79 9 | 2 | 42
80 10| 2 | 28
81 """
82 )
83 result = nodes.sort(key=nodes.key, instance=nodes.instance)
84
85 assert_table_equality(
86 result,
87 T(
88 """
89 | next | prev
90 1 | 9 |
91 2 | 10 |
92 3 | 7 | 5
93 4 | 8 | 6
94 5 | 3 | 9
95 6 | 4 | 10
96 7 | | 3
97 8 | | 4
98 9 | 5 | 1
99 10 | 6 | 2
100 """,
101 ).select(
102 prev=nodes.pointer_from(this.prev, optional=True),
103 next=nodes.pointer_from(this.next, optional=True),
104 ),
105 )

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