()
| 129 | #[cfg(any(not(Py_LIMITED_API), Py_3_11))] |
| 130 | #[test] |
| 131 | fn test_buffer_add() { |
| 132 | Python::attach(|py| { |
| 133 | let f = wrap_pyfunction!(buffer_inplace_add)(py).unwrap(); |
| 134 | |
| 135 | py_expect_exception!( |
| 136 | py, |
| 137 | f, |
| 138 | r#" |
| 139 | import array |
| 140 | a = array.array("i", [0, 1, 2, 3]) |
| 141 | b = array.array("I", [0, 1, 2, 3]) |
| 142 | f(a, b) |
| 143 | "#, |
| 144 | PyBufferError |
| 145 | ); |
| 146 | |
| 147 | pyo3::py_run!( |
| 148 | py, |
| 149 | f, |
| 150 | r#" |
| 151 | import array |
| 152 | a = array.array("i", [0, 1, 2, 3]) |
| 153 | b = array.array("i", [2, 3, 4, 5]) |
| 154 | f(a, b) |
| 155 | assert a, array.array("i", [2, 4, 6, 8]) |
| 156 | "# |
| 157 | ); |
| 158 | }); |
| 159 | } |
| 160 | |
| 161 | #[cfg(not(PyPy))] |
| 162 | #[pyfunction] |
nothing calls this directly
no outgoing calls
no test coverage detected