aboutsummaryrefslogtreecommitdiffstats
path: root/library/python/testing/yatest_lib/tests/test_external.py
blob: 18cb560b1793d746c2a80c31203b36939ba16c6c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import enum
import pytest

from yatest_lib import external


class MyEnum(enum.Enum):
    VAL1 = 1
    VAL2 = 2


@pytest.mark.parametrize("data, expected_val, expected_type", [
    ({}, {}, dict),
    (MyEnum.VAL1, "MyEnum.VAL1", str),
    ({MyEnum.VAL1: MyEnum.VAL2}, {"MyEnum.VAL1": "MyEnum.VAL2"}, dict),
])
def test_serialize(data, expected_val, expected_type):
    data = external.serialize(data)
    assert expected_type == type(data), data
    assert expected_val == data