Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Commit b27be05

Browse files
committed
Run pre-commit
1 parent 62472cc commit b27be05

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

test_project/api/views/products.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Dict
2+
13
from rest_framework.request import Request
24
from rest_framework.response import Response
35
from rest_framework.status import HTTP_200_OK
@@ -6,26 +8,10 @@
68

79
class Products(APIView):
810
def get(self, request: Request, version: int, category_pk: int, subcategory_pk: int) -> Response:
9-
products = {
10-
1: {
11-
1: {},
12-
2: {},
13-
3: {}
14-
},
15-
2: {
16-
1: {},
17-
2: {},
18-
3: {}
19-
},
20-
3: {
21-
1: {},
22-
2: {},
23-
3: {}
24-
},
25-
4: {
26-
1: {},
27-
2: {},
28-
3: {}
29-
}
11+
products: Dict[int, Dict] = {
12+
1: {1: {}, 2: {}, 3: {}},
13+
2: {1: {}, 2: {}, 3: {}},
14+
3: {1: {}, 2: {}, 3: {}},
15+
4: {1: {}, 2: {}, 3: {}},
3016
}
3117
return Response(products.get(category_pk, {}).get(subcategory_pk, {}), HTTP_200_OK)

test_project/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
from test_project.api.views.i18n import Languages
1212
from test_project.api.views.items import Items
1313
from test_project.api.views.names import NamesRetrieveView, NameViewSet
14+
from test_project.api.views.products import Products
1415
from test_project.api.views.snake_cased_response import SnakeCasedResponse
1516
from test_project.api.views.trucks import BadTrucks, GoodTrucks
1617
from test_project.api.views.vehicles import Vehicles
17-
from test_project.api.views.products import Products
1818

1919
router = routers.SimpleRouter()
2020
router.register(r"names", NameViewSet)

tests/test_loaders.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ def test_loader_resolve_path(loader):
4848

4949
@pytest.mark.parametrize("loader", static_schema_loaders)
5050
def test_static_loader_resolve_nested_route(loader):
51-
assert loader.resolve_path("/api/v1/categories/1/subcategories/1/", "get")[0] == "/api/{version}/categories/{category_pk}/subcategories/{subcategory_pk}/"
51+
assert (
52+
loader.resolve_path("/api/v1/categories/1/subcategories/1/", "get")[0]
53+
== "/api/{version}/categories/{category_pk}/subcategories/{subcategory_pk}/"
54+
)

0 commit comments

Comments
 (0)