Skip to content

Commit bd552cf

Browse files
committed
removed deprecation
1 parent 9ee9d87 commit bd552cf

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

services/director-v2/tests/unit/test_models_comp_runs.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,33 @@
88
import pytest
99
from models_library.projects_state import RunningState
1010
from pydantic.main import BaseModel
11+
from pytest_simcore.pydantic_models import (
12+
assert_validation_model,
13+
iter_model_examples_in_class,
14+
)
1115
from simcore_service_director_v2.models.comp_runs import CompRunsAtDB
1216

1317

1418
@pytest.mark.parametrize(
15-
"model_cls",
16-
[
17-
CompRunsAtDB,
18-
],
19+
"model_cls, example_name, example_data",
20+
iter_model_examples_in_class(CompRunsAtDB),
1921
)
2022
def test_computation_run_model_examples(
21-
model_cls: type[BaseModel], model_cls_examples: dict[str, dict[str, Any]]
23+
model_cls: type[BaseModel], example_name: str, example_data: dict[str, Any]
2224
):
23-
for name, example in model_cls_examples.items():
24-
print(name, ":", pformat(example))
25-
model_instance = model_cls(**example)
26-
assert model_instance, f"Failed with {name}"
25+
assert_validation_model(
26+
model_cls, example_name=example_name, example_data=example_data
27+
)
2728

2829

2930
@pytest.mark.parametrize(
30-
"model_cls",
31-
[
32-
CompRunsAtDB,
33-
],
31+
"model_cls, example_name, example_data",
32+
iter_model_examples_in_class(CompRunsAtDB),
3433
)
3534
def test_computation_run_model_with_run_result_value_field(
36-
model_cls: type[BaseModel], model_cls_examples: dict[str, dict[str, Any]]
35+
model_cls: type[BaseModel], example_name: str, example_data: dict[str, Any]
3736
):
38-
for name, example in model_cls_examples.items():
39-
example["result"] = RunningState.WAITING_FOR_RESOURCES.value
40-
print(name, ":", pformat(example))
41-
model_instance = model_cls(**example)
42-
assert model_instance, f"Failed with {name}"
37+
example_data["result"] = RunningState.WAITING_FOR_RESOURCES.value
38+
print(example_name, ":", pformat(example_data))
39+
model_instance = model_cls(**example_data)
40+
assert model_instance, f"Failed with {example_name}"

0 commit comments

Comments
 (0)