mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2024-11-14 18:54:28 +00:00
test shape ellipsis at last
This commit is contained in:
parent
f9a992843e
commit
16b0eb0542
2 changed files with 14 additions and 0 deletions
|
@ -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():
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -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]:
|
||||||
|
|
Loading…
Reference in a new issue