()
| 179 | starting_ref_count = [] |
| 180 | |
| 181 | def outerScope(): |
| 182 | def pyFunc(): |
| 183 | return 42 |
| 184 | |
| 185 | ref.append(weakref.ref(pyFunc)) |
| 186 | starting_ref_count.append(sys.getrefcount(pyFunc)) |
| 187 | assert 42 == pm.eval("(func) => func()")(pyFunc) |
| 188 | |
| 189 | assert ref[0]() is pyFunc |
| 190 | current_ref_count = sys.getrefcount(pyFunc) |
| 191 | assert current_ref_count == starting_ref_count[0] + 1 |
| 192 | |
| 193 | outerScope() |
| 194 | pm.collect() # this should collect the JS proxy to pyFunc, which should decref pyFunc |
no test coverage detected