Skip to content

Commit bc42b5e

Browse files
committed
minor corrections
1 parent 3fc1767 commit bc42b5e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

clients/python/test/test_osparc/conftest.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ def all_server_paths(osparc_openapi_specs: dict[str, Any]) -> set[ServerPath]:
8585
@pytest.fixture
8686
def create_osparc_response_model(
8787
osparc_openapi_specs: dict[str, Any],
88-
) -> Callable[[str], BaseModel]:
88+
) -> Callable[[type[T]], T]:
8989
def _create_model(model_type: type[T]) -> T:
9090
schemas = osparc_openapi_specs.get("components", {}).get("schemas", {})
91-
example_data = schemas.get(model_type.__name__, {}).get("example", {})
91+
example_data = schemas.get(model_type.__name__, {}).get("example")
9292
error_msg = "Could not extract example data for"
9393
error_msg += f" '{model_type.__name__}' from openapi specs"
9494
assert example_data, error_msg
@@ -103,7 +103,7 @@ def create_server_mock(
103103
osparc_openapi_specs: dict[str, Any],
104104
all_server_paths: set[ServerPath],
105105
create_osparc_response_model: Callable[[str], BaseModel],
106-
) -> Callable[[int, BaseModel], None]:
106+
) -> Callable[[int], None]:
107107
def _mock_server(_status: int) -> None:
108108
def _sideeffect(
109109
method: str,
@@ -131,16 +131,16 @@ def _sideeffect(
131131
.get(method.lower(), {})
132132
.get("responses")
133133
)
134-
assert (
135-
responses is not None
136-
), f"status code {_status} is not a return code of {method.upper()} {matching_path}"
134+
assert responses is not None
137135
schema = (
138136
responses.get(f"{_status}", {})
139137
.get("content", {})
140138
.get("application/json", {})
141139
.get("schema")
142140
)
143-
assert schema is not None
141+
assert (
142+
schema is not None
143+
), f"probably status code {_status} is not a return code of {method.upper()} {matching_path}"
144144
response_model_type = getattr(osparc, schema.get("title"))
145145
response_model = create_osparc_response_model(response_model_type)
146146
response = HTTPResponse(

0 commit comments

Comments
 (0)