File size: 834 Bytes
7cc81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""Regression tests for the Python 3.10 production runtime contract."""

from app.core.enums import StrEnum
from app.social.domain.enums import JobStatus, Provider
from app.social.schemas.tiktok import TikTokPrivacyLevel
from app.social.schemas.youtube import YouTubePrivacyStatus


def test_string_enums_do_not_require_python_311_stdlib() -> None:
    class Example(StrEnum):
        VALUE = "value"

    assert Example.VALUE == "value"
    assert str(Example.VALUE) == "value"
    assert f"{Example.VALUE}" == "value"
    assert Example.VALUE.value == "value"


def test_social_schema_enums_keep_wire_values() -> None:
    assert str(Provider.TIKTOK) == "tiktok"
    assert str(JobStatus.PUBLISHED) == "published"
    assert str(TikTokPrivacyLevel.SELF_ONLY) == "SELF_ONLY"
    assert str(YouTubePrivacyStatus.PRIVATE) == "private"