@@ -272,6 +272,7 @@ def test_event_source_with_invalid_domain_name(self):
272272
273273 def test_detect_lambda_function_url_domain_with_invalid_input (self ):
274274 from datadog_lambda .trigger import detect_lambda_function_url_domain
275+
275276 # Test with non-string input
276277 self .assertFalse (detect_lambda_function_url_domain (None ))
277278 self .assertFalse (detect_lambda_function_url_domain (12345 ))
@@ -555,25 +556,30 @@ def test_extract_trigger_tags_list_type_event(self):
555556
556557 def test_extract_http_tags_with_invalid_request_context (self ):
557558 from datadog_lambda .trigger import extract_http_tags
559+
558560 # Test with requestContext as a string instead of a dict
559561 event = {"requestContext" : "not_a_dict" , "path" : "/test" , "httpMethod" : "GET" }
560562 http_tags = extract_http_tags (event )
561563 # Should still extract valid tags from the event
562- self .assertEqual (http_tags , {"http.url_details.path" : "/test" , "http.method" : "GET" })
564+ self .assertEqual (
565+ http_tags , {"http.url_details.path" : "/test" , "http.method" : "GET" }
566+ )
563567
564568 def test_extract_http_tags_with_invalid_apigateway_http (self ):
565569 from datadog_lambda .trigger import extract_http_tags
570+
566571 # Test with http in requestContext that's not a dict
567572 event = {
568573 "requestContext" : {"stage" : "prod" , "http" : "not_a_dict" },
569- "version" : "2.0"
574+ "version" : "2.0" ,
570575 }
571576 http_tags = extract_http_tags (event )
572577 # Should not raise an exception
573578 self .assertEqual (http_tags , {})
574579
575580 def test_extract_http_tags_with_invalid_headers (self ):
576581 from datadog_lambda .trigger import extract_http_tags
582+
577583 # Test with headers that's not a dict
578584 event = {"headers" : "not_a_dict" }
579585 http_tags = extract_http_tags (event )
@@ -582,6 +588,7 @@ def test_extract_http_tags_with_invalid_headers(self):
582588
583589 def test_extract_http_tags_with_invalid_route (self ):
584590 from datadog_lambda .trigger import extract_http_tags
591+
585592 # Test with routeKey that would cause a split error
586593 event = {"routeKey" : 12345 } # Not a string
587594 http_tags = extract_http_tags (event )
0 commit comments