test_external.py 480 B

1234567891011121314151617181920
  1. import enum
  2. import pytest
  3. from yatest_lib import external
  4. class MyEnum(enum.Enum):
  5. VAL1 = 1
  6. VAL2 = 2
  7. @pytest.mark.parametrize("data, expected_val, expected_type", [
  8. ({}, {}, dict),
  9. (MyEnum.VAL1, "MyEnum.VAL1", str),
  10. ({MyEnum.VAL1: MyEnum.VAL2}, {"MyEnum.VAL1": "MyEnum.VAL2"}, dict),
  11. ])
  12. def test_serialize(data, expected_val, expected_type):
  13. data = external.serialize(data)
  14. assert expected_type == type(data), data
  15. assert expected_val == data