mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
added py::ellipsis() method for slicing of multidimensional NumPy arrays
This PR adds a new py::ellipsis() method which can be used in conjunction with NumPy's generalized slicing support. For instance, the following is now valid (where "a" is a NumPy array): py::array b = a[py::make_tuple(0, py::ellipsis(), 0)];
This commit is contained in:
@@ -408,3 +408,9 @@ def test_array_create_and_resize(msg):
|
||||
a = m.create_and_resize(2)
|
||||
assert(a.size == 4)
|
||||
assert(np.all(a == 42.))
|
||||
|
||||
|
||||
@pytest.unsupported_on_py2
|
||||
def test_index_using_ellipsis():
|
||||
a = m.index_using_ellipsis(np.zeros((5, 6, 7)))
|
||||
assert a.shape == (6,)
|
||||
|
||||
Reference in New Issue
Block a user