(m)
| 210 | |
| 211 | @pytest.mark.parametrize("m", submodules) |
| 212 | def test_round_trip(m): |
| 213 | assert_equal_tensor_ref(m.round_trip_tensor(tensor_ref)) |
| 214 | |
| 215 | with pytest.raises(TypeError, match="^Cannot cast array data from"): |
| 216 | assert_equal_tensor_ref(m.round_trip_tensor2(tensor_ref)) |
| 217 | |
| 218 | assert_equal_tensor_ref(m.round_trip_tensor2(np.array(tensor_ref, dtype=np.int32))) |
| 219 | assert_equal_tensor_ref(m.round_trip_fixed_tensor(tensor_ref)) |
| 220 | assert_equal_tensor_ref(m.round_trip_aligned_view_tensor(m.reference_tensor())) |
| 221 | |
| 222 | copy = np.array(tensor_ref, dtype=np.float64, order=m.needed_options) |
| 223 | assert_equal_tensor_ref(m.round_trip_view_tensor(copy)) |
| 224 | assert_equal_tensor_ref(m.round_trip_view_tensor_ref(copy)) |
| 225 | assert_equal_tensor_ref(m.round_trip_view_tensor_ptr(copy)) |
| 226 | copy.setflags(write=False) |
| 227 | assert_equal_tensor_ref(m.round_trip_const_view_tensor(copy)) |
| 228 | |
| 229 | np.testing.assert_array_equal( |
| 230 | tensor_ref[:, ::-1, :], m.round_trip_tensor(tensor_ref[:, ::-1, :]) |
| 231 | ) |
| 232 | |
| 233 | assert m.round_trip_rank_0(np.float64(3.5)) == 3.5 |
| 234 | assert m.round_trip_rank_0(3.5) == 3.5 |
| 235 | |
| 236 | with pytest.raises( |
| 237 | TypeError, |
| 238 | match=r"^round_trip_rank_0_noconvert\(\): incompatible function arguments", |
| 239 | ): |
| 240 | m.round_trip_rank_0_noconvert(np.float64(3.5)) |
| 241 | |
| 242 | with pytest.raises( |
| 243 | TypeError, |
| 244 | match=r"^round_trip_rank_0_noconvert\(\): incompatible function arguments", |
| 245 | ): |
| 246 | m.round_trip_rank_0_noconvert(3.5) |
| 247 | |
| 248 | with pytest.raises( |
| 249 | TypeError, match=r"^round_trip_rank_0_view\(\): incompatible function arguments" |
| 250 | ): |
| 251 | m.round_trip_rank_0_view(np.float64(3.5)) |
| 252 | |
| 253 | with pytest.raises( |
| 254 | TypeError, match=r"^round_trip_rank_0_view\(\): incompatible function arguments" |
| 255 | ): |
| 256 | m.round_trip_rank_0_view(3.5) |
| 257 | |
| 258 | |
| 259 | @pytest.mark.parametrize("m", submodules) |
nothing calls this directly
no test coverage detected