MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / test_flatMap_equivalence

Function test_flatMap_equivalence

tests/python/test_arrays.py:2207–2213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2205
2206
2207def test_flatMap_equivalence():
2208 items = [1, 2, 1]
2209 result = [0]
2210 result2 = [0]
2211 pm.eval("(result, arr) => {result[0] = arr.flatMap((num) => (num === 2 ? [2, 2] : 1))}")(result, items)
2212 pm.eval("(result, arr) => {result[0] = arr.map((num) => (num === 2 ? [2, 2] : 1)).flat()}")(result2, items)
2213 assert result[0] == result2[0]
2214
2215
2216def test_flatMap_check_index():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected