test shape ellipsis at last

This commit is contained in:
sneakers-the-rat 2024-09-23 17:35:24 -07:00
parent f9a992843e
commit 16b0eb0542
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D
2 changed files with 14 additions and 0 deletions

View file

@ -172,6 +172,18 @@ def test_ndarray_coercion():
amod = Model(array=["a", "b", "c"]) amod = Model(array=["a", "b", "c"])
@pytest.mark.shape
def test_shape_ellipsis():
"""
Test that ellipsis is a wildcard, rather than "repeat the last index"
"""
class MyModel(BaseModel):
array: NDArray[Shape["1, 2, ..."], Number]
_ = MyModel(array=np.zeros((1, 2, 3, 4, 5)))
@pytest.mark.serialization @pytest.mark.serialization
def test_ndarray_serialize(): def test_ndarray_serialize():
""" """

View file

@ -12,6 +12,8 @@ from typing import Callable
import numpy as np import numpy as np
import json import json
pytestmark = pytest.mark.serialization
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def hdf5_at_path() -> Callable[[Path], None]: def hdf5_at_path() -> Callable[[Path], None]: