Skip to content

Commit

Permalink
remove match from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-codecov committed Oct 30, 2024
1 parent 29e9045 commit dc6660e
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions tests/integrations/rust_tracing/test_rust_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,18 @@ def test_on_new_span_without_transaction(sentry_init, reset_integrations):


def test_on_event_exception(sentry_init, reset_integrations, capture_events):
def event_type_mapping(metadata: dict) -> EventTypeMapping:
match RustTracingLevel(metadata.get("level")):
case RustTracingLevel.Error:
return EventTypeMapping.Exc
case RustTracingLevel.Warn | RustTracingLevel.Info:
return EventTypeMapping.Breadcrumb
case RustTracingLevel.Debug:
return EventTypeMapping.Event
case RustTracingLevel.Trace:
return EventTypeMapping.Ignore
def event_type_mapping(metadata: dict[str, object]) -> EventTypeMapping:
level = RustTracingLevel(metadata.get("level"))
if level == RustTracingLevel.Error:
return EventTypeMapping.Exc
elif level in (RustTracingLevel.Warn, RustTracingLevel.Info):
return EventTypeMapping.Breadcrumb
elif level == RustTracingLevel.Debug:
return EventTypeMapping.Event
elif level == RustTracingLevel.Trace:
return EventTypeMapping.Ignore
else:
return EventTypeMapping.Ignore

rust_tracing = FakeRustTracing()
integration = RustTracingIntegration(
Expand Down Expand Up @@ -207,7 +209,7 @@ def event_type_mapping(metadata: dict) -> EventTypeMapping:


def test_on_event_breadcrumb(sentry_init, reset_integrations, capture_events):
def event_type_mapping(metadata: dict) -> EventTypeMapping:
def event_type_mapping(metadata: dict[str, object]) -> EventTypeMapping:
match RustTracingLevel(metadata.get("level")):
case RustTracingLevel.Error:
return EventTypeMapping.Exc
Expand Down Expand Up @@ -247,7 +249,7 @@ def event_type_mapping(metadata: dict) -> EventTypeMapping:


def test_on_event_event(sentry_init, reset_integrations, capture_events):
def event_type_mapping(metadata: dict) -> EventTypeMapping:
def event_type_mapping(metadata: dict[str, object]) -> EventTypeMapping:
match RustTracingLevel(metadata.get("level")):
case RustTracingLevel.Error:
return EventTypeMapping.Exc
Expand Down Expand Up @@ -293,7 +295,7 @@ def event_type_mapping(metadata: dict) -> EventTypeMapping:


def test_on_event_ignored(sentry_init, reset_integrations, capture_events):
def event_type_mapping(metadata: dict) -> EventTypeMapping:
def event_type_mapping(metadata: dict[str, object]) -> EventTypeMapping:
match RustTracingLevel(metadata.get("level")):
case RustTracingLevel.Error:
return EventTypeMapping.Exc
Expand Down Expand Up @@ -328,7 +330,7 @@ def event_type_mapping(metadata: dict) -> EventTypeMapping:


def test_span_filter(sentry_init, reset_integrations, capture_events):
def span_filter(metadata: dict) -> bool:
def span_filter(metadata: dict[str, object]) -> bool:
return RustTracingLevel(metadata.get("level")) in (
RustTracingLevel.Error,
RustTracingLevel.Warn,
Expand Down Expand Up @@ -385,7 +387,7 @@ def test_record(sentry_init, reset_integrations):


def test_record_in_ignored_span(sentry_init, reset_integrations):
def span_filter(metadata: dict) -> bool:
def span_filter(metadata: dict[str, object]) -> bool:
# Just ignore Trace
return RustTracingLevel(metadata.get("level")) != RustTracingLevel.Trace

Expand Down

0 comments on commit dc6660e

Please sign in to comment.