(mat)
| 344 | @pytest.mark.parametrize("type", ["pybind11", "numpy"]) |
| 345 | def test_to_pybuffer_contiguity(type): |
| 346 | def check_strides(mat): |
| 347 | # The full block is memset to 0, so fill it with non-zero in real spots. |
| 348 | expected = np.arange(1, 5 * 4 + 1).reshape((5, 4)) |
| 349 | for i in range(5): |
| 350 | for j in range(4): |
| 351 | mat[i, j] = expected[i, j] |
| 352 | # If all strides are correct, the exposed buffer should match the input. |
| 353 | np.testing.assert_array_equal(np.array(mat), expected) |
| 354 | |
| 355 | if type == "pybind11": |
| 356 | cmat = m.Matrix(5, 4) # C contiguous. |
no test coverage detected