MCPcopy Create free account
hub / github.com/numpy/numpy / test_buffered_cast_error_paths

Function test_buffered_cast_error_paths

numpy/core/tests/test_nditer.py:2046–2058  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2044
2045
2046def test_buffered_cast_error_paths():
2047 with pytest.raises(ValueError):
2048 # The input is cast into an `S3` buffer
2049 np.nditer((np.array("a", dtype="S1"),), op_dtypes=["i"],
2050 casting="unsafe", flags=["buffered"])
2051
2052 # The `M8[ns]` is cast into the `S3` output
2053 it = np.nditer((np.array(1, dtype="i"),), op_dtypes=["S1"],
2054 op_flags=["writeonly"], casting="unsafe", flags=["buffered"])
2055 with pytest.raises(ValueError):
2056 with it:
2057 buf = next(it)
2058 buf[...] = "a" # cannot be converted to int.
2059
2060@pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess")
2061@pytest.mark.skipif(not HAS_REFCOUNT, reason="PyPy seems to not hit this.")

Callers

nothing calls this directly

Calls 1

nextFunction · 0.50

Tested by

no test coverage detected