From 68235608bf2b0db00304f5d965e535df1773eb26 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 25 May 2026 18:33:10 +0200 Subject: [PATCH 1/3] Use specific rule codes in test_authorized.py --- tests/unit/app/endpoints/test_authorized.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/app/endpoints/test_authorized.py b/tests/unit/app/endpoints/test_authorized.py index 496154a69..2ce4636c0 100644 --- a/tests/unit/app/endpoints/test_authorized.py +++ b/tests/unit/app/endpoints/test_authorized.py @@ -67,10 +67,10 @@ async def test_authorized_dependency_unauthorized() -> None: with pytest.raises(HTTPException) as exc_info: extract_user_token(headers_no_auth) assert exc_info.value.status_code == 401 - assert exc_info.value.detail["response"] == ( # type: ignore + assert exc_info.value.detail["response"] == ( # type: ignore[index] "Missing or invalid credentials provided by client" ) - assert exc_info.value.detail["cause"] == ( # type: ignore + assert exc_info.value.detail["cause"] == ( # type: ignore[index] "No Authorization header found" ) @@ -78,9 +78,9 @@ async def test_authorized_dependency_unauthorized() -> None: with pytest.raises(HTTPException) as exc_info: extract_user_token(headers_invalid_auth) assert exc_info.value.status_code == 401 - assert exc_info.value.detail["response"] == ( # type: ignore + assert exc_info.value.detail["response"] == ( # type: ignore[index] "Missing or invalid credentials provided by client" ) - assert exc_info.value.detail["cause"] == ( # type: ignore + assert exc_info.value.detail["cause"] == ( # type: ignore[index] "No token found in Authorization header" ) From 0230a0b60f2790f927c7b883fbabed2a59fe6ed2 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 25 May 2026 18:33:16 +0200 Subject: [PATCH 2/3] Use specific rule codes in test_config.py --- tests/unit/app/endpoints/test_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/app/endpoints/test_config.py b/tests/unit/app/endpoints/test_config.py index 2cd39fa5c..3a1bde33d 100644 --- a/tests/unit/app/endpoints/test_config.py +++ b/tests/unit/app/endpoints/test_config.py @@ -40,8 +40,8 @@ async def test_config_endpoint_handler_configuration_not_loaded( detail = exc_info.value.detail assert isinstance(detail, dict) - assert detail["response"] == "Configuration is not loaded" # type: ignore - assert detail["cause"] == ( # type: ignore + assert detail["response"] == "Configuration is not loaded" # type: ignore[index] + assert detail["cause"] == ( # type: ignore[index] "Lightspeed Stack configuration has not been initialized." ) From d897e58c018f0a6fe1c6f490fccfece76dd5b291 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 25 May 2026 18:33:28 +0200 Subject: [PATCH 3/3] Use specific rule codes in test_shields.py --- tests/unit/utils/test_shields.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/unit/utils/test_shields.py b/tests/unit/utils/test_shields.py index 9d4dd3c48..745cdf0be 100644 --- a/tests/unit/utils/test_shields.py +++ b/tests/unit/utils/test_shields.py @@ -296,7 +296,7 @@ async def test_raises_http_exception_when_shield_model_not_found( await run_shield_moderation(mock_client, "test input", "/test-endpoint") assert exc_info.value.status_code == status.HTTP_404_NOT_FOUND - assert "missing-model" in exc_info.value.detail["cause"] # type: ignore + assert "missing-model" in exc_info.value.detail["cause"] # type: ignore[index] @pytest.mark.asyncio async def test_raises_http_exception_when_shield_has_no_provider_resource_id( @@ -352,8 +352,8 @@ async def test_shield_ids_raises_404_when_no_shields_found( ) assert exc_info.value.status_code == status.HTTP_404_NOT_FOUND - assert "Shield" in exc_info.value.detail["response"] # type: ignore - assert "typo-shield" in exc_info.value.detail["cause"] # type: ignore + assert "Shield" in exc_info.value.detail["response"] # type: ignore[index] + assert "typo-shield" in exc_info.value.detail["cause"] # type: ignore[index] @pytest.mark.asyncio async def test_shield_ids_filters_to_specific_shield( @@ -577,8 +577,8 @@ async def test_raises_404_when_requested_shield_not_configured( ) assert exc_info.value.status_code == status.HTTP_404_NOT_FOUND - assert "Shield" in exc_info.value.detail["response"] # type: ignore - assert "missing-shield" in exc_info.value.detail["cause"] # type: ignore + assert "Shield" in exc_info.value.detail["response"] # type: ignore[index] + assert "missing-shield" in exc_info.value.detail["cause"] # type: ignore[index] @pytest.mark.asyncio async def test_raises_404_when_multiple_requested_shields_not_configured( @@ -594,8 +594,8 @@ async def test_raises_404_when_multiple_requested_shields_not_configured( ) assert exc_info.value.status_code == status.HTTP_404_NOT_FOUND - assert "Shields" in exc_info.value.detail["response"] # type: ignore - cause = exc_info.value.detail["cause"] # type: ignore + assert "Shields" in exc_info.value.detail["response"] # type: ignore[index] + cause = exc_info.value.detail["cause"] # type: ignore[index] assert "missing-1" in cause assert "missing-2" in cause