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

Function test_every_self_pymethod

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

Source from the content-addressed store, hash-verified

1791
1792
1793def test_every_self_pymethod():
1794 items = ['Four', 'Three', 'One']
1795
1796 class Counter:
1797 def __init__(self):
1798 self.count = 0
1799
1800 def increment(self, element, index, array):
1801 self.count += 1
1802 return True
1803
1804 obj = Counter()
1805 assert obj.count == 0
1806 result = pm.eval("""
1807 (arr, increment, result) => {
1808 let jsObj = {count: 0}
1809 arr.every(increment, jsObj);
1810 return jsObj.count;
1811 }
1812 """)(items, obj.increment)
1813 assert obj.count == 0
1814 assert result == 3
1815
1816
1817def test_every_self_pyfunction():

Callers

nothing calls this directly

Calls 1

CounterClass · 0.85

Tested by

no test coverage detected