2024-10-04 02:57:54 +00:00
|
|
|
import pytest
|
2024-04-09 01:36:47 +00:00
|
|
|
|
2024-10-04 06:18:18 +00:00
|
|
|
from numpydantic.testing.cases import DTYPE_CASES, SHAPE_CASES
|
2024-10-04 02:33:40 +00:00
|
|
|
from numpydantic.testing.helpers import ValidationCase
|
2024-04-23 02:31:56 +00:00
|
|
|
from tests.fixtures import *
|
2024-04-09 01:36:47 +00:00
|
|
|
|
|
|
|
|
2024-04-23 02:31:56 +00:00
|
|
|
def pytest_addoption(parser):
|
|
|
|
parser.addoption(
|
|
|
|
"--with-output",
|
|
|
|
action="store_true",
|
|
|
|
help="Keep test outputs in the __tmp__ directory",
|
|
|
|
)
|
2024-05-09 04:29:13 +00:00
|
|
|
|
|
|
|
|
2024-10-04 07:46:49 +00:00
|
|
|
@pytest.fixture(
|
|
|
|
scope="function", params=[pytest.param(c, id=c.id) for c in SHAPE_CASES]
|
|
|
|
)
|
|
|
|
def shape_cases(request, tmp_output_dir_func) -> ValidationCase:
|
|
|
|
case: ValidationCase = request.param.model_copy()
|
|
|
|
case.path = tmp_output_dir_func
|
|
|
|
return case
|
2024-05-09 04:29:13 +00:00
|
|
|
|
|
|
|
|
2024-10-04 07:46:49 +00:00
|
|
|
@pytest.fixture(
|
|
|
|
scope="function", params=[pytest.param(c, id=c.id) for c in DTYPE_CASES]
|
|
|
|
)
|
|
|
|
def dtype_cases(request, tmp_output_dir_func) -> ValidationCase:
|
|
|
|
case: ValidationCase = request.param.model_copy()
|
|
|
|
case.path = tmp_output_dir_func
|
|
|
|
return case
|