File: test_common.py

package info (click to toggle)
python-mashumaro 3.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,408 kB
  • sloc: python: 19,981; sh: 16; makefile: 5
file content (17 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pytest

from mashumaro.types import Discriminator


def test_discriminator_without_necessary_params():
    with pytest.raises(ValueError) as exc_info:
        Discriminator()
    assert str(exc_info.value) == (
        "Either 'include_supertypes' or 'include_subtypes' must be enabled"
    )

    with pytest.raises(ValueError) as exc_info:
        Discriminator(field="type")
    assert str(exc_info.value) == (
        "Either 'include_supertypes' or 'include_subtypes' must be enabled"
    )