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

Function test_find_self_pyfunction

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

Source from the content-addressed store, hash-verified

1951
1952
1953def test_find_self_pyfunction():
1954 items = ['Four', 'Three', 'One']
1955
1956 def increment(self, element, index, array):
1957 self.count += 1
1958 return False
1959
1960 try:
1961 pm.eval("""
1962 (arr, increment, result) => {
1963 let jsObj = {count: 0}
1964 arr.find(increment, jsObj);
1965 return jsObj.count;
1966 }
1967 """)(items, increment)
1968 assert False
1969 except Exception as e:
1970 assert type(e) is TypeError
1971 assert str(e).__contains__("unbound python functions do not have a 'self' to bind")
1972
1973
1974def test_find_self_jsfunction():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected