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

Function test_flatMap

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

Source from the content-addressed store, hash-verified

2172
2173
2174def test_flatMap():
2175 items = [1, 2, 1]
2176 result = [0]
2177 pm.eval("(result, arr) => {result[0] = arr.flatMap((num) => (num === 2 ? [2, 2] : 1))}")(result, items)
2178 assert items == [1, 2, 1]
2179 assert result[0] == [1, 2, 2, 1]
2180
2181
2182def test_flatMap_with_js_array():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected