numpydantic/tests/test_interface/test_numpy.py

25 lines
576 B
Python
Raw Normal View History

import numpy as np
import pytest
from numpydantic.testing.cases import NumpyCase
2024-09-23 20:28:38 +00:00
pytestmark = pytest.mark.numpy
2024-09-23 20:28:38 +00:00
@pytest.mark.shape
def test_numpy_shape(shape_cases):
shape_cases.interface = NumpyCase
shape_cases.validate_case()
2024-09-23 20:28:38 +00:00
@pytest.mark.dtype
def test_numpy_dtype(dtype_cases):
dtype_cases.interface = NumpyCase
dtype_cases.validate_case()
2024-05-15 03:18:04 +00:00
def test_numpy_coercion(model_blank):
"""If no other interface matches, we try and coerce to a numpy array"""
instance = model_blank(array=[1, 2, 3])
assert isinstance(instance.array, np.ndarray)