@@ -818,10 +818,10 @@ def test_extract_error_attributes_variations():
818818 ):
819819 assert _extract_error_attributes (exc_with_resp ) == {}
820820
821- # 4. error_info with non-string domain, non-string reason, non-mapping metadata
822- error_info_invalid = types .SimpleNamespace (domain = 123 , reason = None , metadata = None )
823- exc_invalid = types .SimpleNamespace (error_info = error_info_invalid )
824- assert _extract_error_attributes (exc_invalid ) == {}
821+ # 4. error_info with empty domain, empty reason, empty metadata
822+ error_info_empty = types .SimpleNamespace (domain = "" , reason = "" , metadata = None )
823+ exc_empty = types .SimpleNamespace (error_info = error_info_empty )
824+ assert _extract_error_attributes (exc_empty ) == {}
825825
826826 # 5. else fallback where target_exc directly has domain, reason, and metadata
827827 exc_fallback = types .SimpleNamespace (
@@ -835,13 +835,13 @@ def test_extract_error_attributes_variations():
835835 "gcp.errors.metadata.f_key" : "42" ,
836836 }
837837
838- # 6. else fallback with invalid types (e.g. domain="", reason=123 , metadata="not a dict" )
839- exc_fallback_invalid = types .SimpleNamespace (
838+ # 6. else fallback with empty attributes (e.g. domain="", reason="" , metadata={} )
839+ exc_fallback_empty = types .SimpleNamespace (
840840 domain = "" ,
841- reason = 123 ,
842- metadata = "string_without_items" ,
841+ reason = "" ,
842+ metadata = {} ,
843843 )
844- assert _extract_error_attributes (exc_fallback_invalid ) == {}
844+ assert _extract_error_attributes (exc_fallback_empty ) == {}
845845
846846
847847def test_wrap_method_otel_tracing_partial_span_capabilities (mock_otel ):
0 commit comments