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

Function test_some_self_pyfunction

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

Source from the content-addressed store, hash-verified

1685
1686
1687def test_some_self_pyfunction():
1688 items = ['Four', 'Three', 'One']
1689
1690 def increment(self, element, index, array):
1691 self.count += 1
1692 return False
1693
1694 try:
1695 pm.eval("""
1696 (arr, increment, result) => {
1697 let jsObj = {count: 0}
1698 arr.some(increment, jsObj);
1699 return jsObj.count;
1700 }
1701 """)(items, increment)
1702 assert False
1703 except Exception as e:
1704 assert type(e) is TypeError
1705 assert str(e).__contains__("unbound python functions do not have a 'self' to bind")
1706
1707
1708def test_some_self_jsfunction():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected