diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bb83956..96b7b5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -21,23 +21,21 @@ repos: args: ["--fix=crlf"] files: \.bat$ - repo: https://github.com/pycqa/isort - # Note: 5.12.0+ doesn't work with 3.7 anymore - rev: 5.11.5 + rev: 5.12.0 hooks: - id: isort language_version: python3 - repo: https://github.com/psf/black - rev: 23.1.0 + rev: 23.11.0 hooks: - id: black language_version: python3 - repo: https://github.com/pre-commit/mirrors-prettier - rev: v2.7.1 + rev: v3.1.0 hooks: - id: prettier - repo: https://github.com/pycqa/flake8 - # Note: 6.0.0+ doesn't work with 3.7 anymore - rev: 5.0.4 + rev: 6.1.0 hooks: - id: flake8 - repo: https://github.com/twu/skjold diff --git a/openapi_to_fastapi/tests/test_router.py b/openapi_to_fastapi/tests/test_router.py index 09b9ec4..d4a49d1 100644 --- a/openapi_to_fastapi/tests/test_router.py +++ b/openapi_to_fastapi/tests/test_router.py @@ -226,7 +226,7 @@ def test_custom_responses(app, specs_root): # Check custom response models are parsed route_info = spec_router.get_route_info(brew_spec, "post") resp_models = route_info.get_additional_response_models() - assert type(resp_models[418]) == type(BaseModel) + assert issubclass(resp_models[418], BaseModel) # Check the response is added to OpenAPI spec and has a description and schema spec = app.openapi() @@ -238,6 +238,6 @@ def test_custom_responses(app, specs_root): route = [r for r in router.routes if r.path == brew_spec][0] assert route.responses[418]["description"] == "I'm a teapot" model = route.responses[418]["model"] - assert type(model) == type(BaseModel) - assert "ok" in model.__fields__ - assert "errorMessage" in model.__fields__ + assert issubclass(model, BaseModel) + assert "ok" in model.model_fields + assert "errorMessage" in model.model_fields