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

Function test_skips

python/pathway/tests/test_transformers.py:114–164  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112
113
114def test_skips():
115 @transformer
116 class list_traversal:
117 class nodes(ClassArg):
118 next = input_attribute()
119 val = input_attribute()
120
121 class requests(ClassArg):
122 node = input_attribute()
123 steps = input_attribute()
124
125 @output_attribute
126 def reached_node(self) -> int:
127 node = self.transformer.nodes[self.node]
128 for _ in range(self.steps):
129 node = self.transformer.nodes[node.next]
130 return node.id
131
132 @output_attribute
133 def reached_value(self) -> int:
134 node = self.transformer.nodes[self.reached_node]
135 return node.val
136
137 nodes = T(
138 """
139 | next | val
140 1 | 2 | 11
141 2 | 3 | 12
142 3 | | 13
143 """
144 ).with_columns(next=this.pointer_from(this.next))
145
146 requests = T(
147 """
148 | node | steps
149 10 | 1 | 1
150 20 | 3 | 0
151 """
152 ).with_columns(node=nodes.pointer_from(this.node))
153
154 replies = list_traversal(nodes, requests).requests
155 assert_table_equality_wo_types( # XXX: no Pointer in schema
156 replies,
157 T(
158 """
159 | reached_node | reached_value
160 10 | 2 | 12
161 20 | 3 | 13
162 """
163 ).with_columns(reached_node=nodes.pointer_from(this.reached_node)),
164 )
165
166
167def test_output_attribute_rename():

Callers

nothing calls this directly

Calls 4

TFunction · 0.90
list_traversalClass · 0.85
with_columnsMethod · 0.80
pointer_fromMethod · 0.45

Tested by

no test coverage detected