1+ from typing import List , Union
2+
13import pytest
24from 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
69from 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)
179182def 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
576577def 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