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

Function test_map_self_pyfunction

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

Source from the content-addressed store, hash-verified

1225
1226
1227def test_map_self_pyfunction():
1228 items = ['Four', 'Three', 'One']
1229
1230 def increment(self, element, index, array):
1231 self.count += 1
1232
1233 try:
1234 pm.eval("""
1235 (arr, increment, result) => {
1236 let jsObj = {count: 0}
1237 arr.map(increment, jsObj);
1238 return jsObj.count;
1239 }
1240 """)(items, increment)
1241 assert False
1242 except Exception as e:
1243 assert type(e) is TypeError
1244 assert str(e).__contains__("unbound python functions do not have a 'self' to bind")
1245
1246
1247def test_map_self_jsfunction():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected