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

Function test_json_get_array_index

python/pathway/tests/test_json.py:212–223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

210
211
212def test_json_get_array_index():
213 input = _json_table(
214 index=[0, 1, 2],
215 data=[{"field": [1, 2, 3]}, {"field": [4, 5, 6]}, {"field": [7, 8, 9]}],
216 )
217
218 result = input.select(result=pw.this.data["field"][pw.this.index.as_int()])
219
220 assert_table_equality(
221 _json_table(result=[1, 5, 9]),
222 result,
223 )
224
225
226@pytest.mark.parametrize("index", [-1, -4, 3])

Callers

nothing calls this directly

Calls 3

_json_tableFunction · 0.85
selectMethod · 0.45
as_intMethod · 0.45

Tested by

no test coverage detected