Prior to 2.2, `py::init<...>` relied on the type supporting placement new; this tests a class without placement new support.
(capture)
| 309 | |
| 310 | @pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC") |
| 311 | def test_no_placement_new(capture): |
| 312 | """Prior to 2.2, `py::init<...>` relied on the type supporting placement |
| 313 | new; this tests a class without placement new support.""" |
| 314 | with capture: |
| 315 | a = m.NoPlacementNew(123) |
| 316 | |
| 317 | found = re.search(r"^operator new called, returning (\d+)\n$", str(capture)) |
| 318 | assert found |
| 319 | assert a.i == 123 |
| 320 | with capture: |
| 321 | del a |
| 322 | pytest.gc_collect() |
| 323 | assert capture == "operator delete called on " + found.group(1) |
| 324 | |
| 325 | with capture: |
| 326 | b = m.NoPlacementNew() |
| 327 | |
| 328 | found = re.search(r"^operator new called, returning (\d+)\n$", str(capture)) |
| 329 | assert found |
| 330 | assert b.i == 100 |
| 331 | with capture: |
| 332 | del b |
| 333 | pytest.gc_collect() |
| 334 | assert capture == "operator delete called on " + found.group(1) |
| 335 | |
| 336 | |
| 337 | def test_multiple_inheritance(): |
nothing calls this directly
no test coverage detected