| 187 | ], |
| 188 | ) |
| 189 | def test_unique_ptr_consumer_roundtrip(pass_f, rtrn_f, moved_out, moved_in): |
| 190 | c = m.uconsumer() |
| 191 | assert not c.valid() |
| 192 | recycled = m.atyp("passenger") |
| 193 | mtxt_orig = m.get_mtxt(recycled) |
| 194 | assert re.match("passenger_(MvCtor){1,2}", mtxt_orig) |
| 195 | |
| 196 | pass_f(c, recycled) |
| 197 | if moved_out: |
| 198 | with pytest.raises(ValueError) as excinfo: |
| 199 | m.get_mtxt(recycled) |
| 200 | assert "Python instance was disowned" in str(excinfo.value) |
| 201 | |
| 202 | recycled = rtrn_f(c) |
| 203 | assert c.valid() != moved_in |
| 204 | assert m.get_mtxt(recycled) == mtxt_orig |
| 205 | |
| 206 | |
| 207 | def test_py_type_handle_of_atyp(): |