(val, ctor, loader)
| 25 | assert "incompatible function arguments" in str(excinfo.value) |
| 26 | |
| 27 | def test_shared(val, ctor, loader): |
| 28 | obj = ctor(val) |
| 29 | with suppress(AttributeError): # non-cpython VMs don't have getrefcount |
| 30 | rc_before = sys.getrefcount(obj) |
| 31 | wrapper = loader(obj) |
| 32 | # wrapper holds a shared_ptr that keeps obj alive |
| 33 | assert wrapper.use_count == 1 |
| 34 | assert wrapper.value == val |
| 35 | with suppress(AttributeError): |
| 36 | rc_after = sys.getrefcount(obj) |
| 37 | assert rc_after > rc_before |
| 38 | |
| 39 | test_shared(220, cm.ExternalType2, m.load_external2_shared) |
| 40 | test_shared(330, cm.ExternalType3, m.load_external3_shared) |
no outgoing calls
no test coverage detected