(capture)
| 283 | |
| 284 | @pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC") |
| 285 | def test_numpy_view(capture): |
| 286 | with capture: |
| 287 | ac = m.ArrayClass() |
| 288 | ac_view_1 = ac.numpy_view() |
| 289 | ac_view_2 = ac.numpy_view() |
| 290 | assert np.all(ac_view_1 == np.array([1, 2], dtype=np.int32)) |
| 291 | del ac |
| 292 | pytest.gc_collect() |
| 293 | assert ( |
| 294 | capture |
| 295 | == """ |
| 296 | ArrayClass() |
| 297 | ArrayClass::numpy_view() |
| 298 | ArrayClass::numpy_view() |
| 299 | """ |
| 300 | ) |
| 301 | ac_view_1[0] = 4 |
| 302 | ac_view_1[1] = 3 |
| 303 | assert ac_view_2[0] == 4 |
| 304 | assert ac_view_2[1] == 3 |
| 305 | with capture: |
| 306 | del ac_view_1 |
| 307 | del ac_view_2 |
| 308 | pytest.gc_collect() |
| 309 | pytest.gc_collect() |
| 310 | assert ( |
| 311 | capture |
| 312 | == """ |
| 313 | ~ArrayClass() |
| 314 | """ |
| 315 | ) |
| 316 | |
| 317 | |
| 318 | def test_cast_numpy_int64_to_uint64(): |
nothing calls this directly
no test coverage detected