Skip to content

Commit cf9495e

Browse files
committed
Fix linter complaints
1 parent e9a2f54 commit cf9495e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

ninja/signature/details.py

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

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

ninja/testing/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def __init__(self, http_response: Union[HttpResponse, StreamingHttpResponse]):
206206
if self.streaming:
207207
self.content = b"".join(http_response.streaming_content) # type: ignore
208208
else:
209-
self.content = http_response.content # type: ignore[union-attr]
209+
self.content = http_response.content
210210
self._data = None
211211

212212
def json(self) -> Any:

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)