forked from getsentry/sentry-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_types.py
More file actions
28 lines (23 loc) · 760 Bytes
/
test_types.py
File metadata and controls
28 lines (23 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
import pytest
from sentry_sdk.types import Event, Hint
@pytest.mark.skipif(
sys.version_info < (3, 10),
reason="Type hinting with `|` is available in Python 3.10+",
)
def test_event_or_none_runtime():
"""
Ensures that the `Event` type's runtime value supports the `|` operation with `None`.
This test is needed to ensure that using an `Event | None` type hint (e.g. for
`before_send`'s return value) does not raise a TypeError at runtime.
"""
Event | None
@pytest.mark.skipif(
sys.version_info < (3, 10),
reason="Type hinting with `|` is available in Python 3.10+",
)
def test_hint_or_none_runtime():
"""
Analogue to `test_event_or_none_runtime`, but for the `Hint` type.
"""
Hint | None