()
| 1951 | |
| 1952 | |
| 1953 | def 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 | |
| 1974 | def test_find_self_jsfunction(): |
nothing calls this directly
no outgoing calls
no test coverage detected