diff --git a/aws_lambda_powertools/event_handler/api_gateway.py b/aws_lambda_powertools/event_handler/api_gateway.py index 1e6fe2a50bb..7f86293fb4a 100644 --- a/aws_lambda_powertools/event_handler/api_gateway.py +++ b/aws_lambda_powertools/event_handler/api_gateway.py @@ -43,7 +43,7 @@ _DYNAMIC_ROUTE_PATTERN = r"(<\w+>)" _SAFE_URI = "-._~()'!*:@,;=" # https://www.ietf.org/rfc/rfc3986.txt # API GW/ALB decode non-safe URI chars; we must support them too -_UNSAFE_URI = "%<> \[\]{}|^" # noqa: W605 +_UNSAFE_URI = r"%<> \[\]{}|^" _NAMED_GROUP_BOUNDARY_PATTERN = rf"(?P\1[{_SAFE_URI}{_UNSAFE_URI}\\w]+)" _ROUTE_REGEX = "^{}$" diff --git a/tests/unit/data_classes/test_api_gateway_authorizer.py b/tests/unit/data_classes/test_api_gateway_authorizer.py index fe4706596c0..52ce96f84e2 100644 --- a/tests/unit/data_classes/test_api_gateway_authorizer.py +++ b/tests/unit/data_classes/test_api_gateway_authorizer.py @@ -31,7 +31,7 @@ def test_authorizer_response_invalid_verb(builder: APIGatewayAuthorizerResponse) def test_authorizer_response_invalid_resource(builder: APIGatewayAuthorizerResponse): - with pytest.raises(ValueError, match="Invalid resource path: \$."): # noqa: W605 + with pytest.raises(ValueError, match=r"Invalid resource path: \$."): # GIVEN an invalid resource path "$" # WHEN calling deny_method builder.deny_route(http_method=HttpVerb.GET.value, resource="$")