Skip to content

Commit 852e4ed

Browse files
committed
Fix linter complaints
1 parent 9bfcb15 commit 852e4ed

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

ninja/signature/details.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def _create_models(self) -> TModels:
184184
return result
185185

186186
def _args_flatten_map(self, args: List[FuncParam]) -> Dict[str, Tuple[str, ...]]:
187-
flatten_map = {}
187+
flatten_map: Dict[str, Tuple[str, ...]] = {}
188188
arg_names: Any = {}
189189
for arg in args:
190190
# Check if this is an optional union type with None default

tests/test_models.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
from typing import List, Union
2+
13
import pytest
24
from pydantic import BaseModel
3-
from typing import Union, List
45

5-
from ninja import Form, Query, Router
6+
from ninja import Form, NinjaAPI, Query, Router
7+
from ninja.errors import ConfigError
8+
from ninja.signature.details import ViewSignature
69
from ninja.testing import TestClient
710

811

@@ -178,8 +181,6 @@ def view_model_collision(
178181
# Test to trigger ConfigError on line 197 - duplicate name collision in union with Query(None)
179182
def test_union_query_name_collision():
180183
"""Test that duplicate union parameter names with Query(None) raise ConfigError."""
181-
from ninja import NinjaAPI
182-
from ninja.errors import ConfigError
183184

184185
# Create a test that should cause a name collision during flattening
185186
try:
@@ -201,7 +202,7 @@ def collision_endpoint(
201202
api.add_router("/test", router_test)
202203

203204
# This should fail during router creation due to name collision
204-
assert False, "Expected ConfigError for duplicate name collision"
205+
assert False, "Expected ConfigError for duplicate name collision" # noqa: B011
205206

206207
except ConfigError as e:
207208
# This is the expected behavior - line 197 should be hit
@@ -575,8 +576,6 @@ def test_invalid_body():
575576

576577
def test_force_line_233_coverage():
577578
"""Force line 233 to be executed by directly calling _model_flatten_map with Union[Model, None]."""
578-
from ninja.signature.details import ViewSignature
579-
from typing import Union
580579

581580
# Create a test function with Union[Model, None] parameter
582581
def test_func(request, param: Union[SomeModel, None]):

0 commit comments

Comments
 (0)