Skip to content

Commit

Permalink
Update pre-commit hooks, fix issues found by updated hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
joakimnordling committed Nov 15, 2023
1 parent 972286c commit 5c8de25
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
12 changes: 5 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions openapi_to_fastapi/tests/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

0 comments on commit 5c8de25

Please sign in to comment.