Test issue #2234: def_buffer with noexcept member function pointers. Covers both new def_buffer specialisations: - def_buffer(Return (Class::*)(Args...) noexcept) - def_buffer(Return (Class::*)(Args...) const noexcept)
()
| 402 | |
| 403 | |
| 404 | def test_noexcept_def_buffer(): |
| 405 | """Test issue #2234: def_buffer with noexcept member function pointers. |
| 406 | |
| 407 | Covers both new def_buffer specialisations: |
| 408 | - def_buffer(Return (Class::*)(Args...) noexcept) |
| 409 | - def_buffer(Return (Class::*)(Args...) const noexcept) |
| 410 | """ |
| 411 | # non-const noexcept member function form |
| 412 | buf = m.OneDBuffer(5) |
| 413 | arr = np.frombuffer(buf, dtype=np.float32) |
| 414 | assert arr.shape == (5,) |
| 415 | arr[2] = 3.14 |
| 416 | arr2 = np.frombuffer(buf, dtype=np.float32) |
| 417 | assert arr2[2] == pytest.approx(3.14) |
| 418 | |
| 419 | # const noexcept member function form |
| 420 | cbuf = m.OneDBufferConst(4) |
| 421 | carr = np.frombuffer(cbuf, dtype=np.float32) |
| 422 | assert carr.shape == (4,) |
| 423 | assert carr.flags["WRITEABLE"] is False |
| 424 | |
| 425 | |
| 426 | def test_ref_qualified_def_buffer(): |
nothing calls this directly
no test coverage detected