File: test_type_converter.py

package info (click to toggle)
python-apischema 0.18.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,636 kB
  • sloc: python: 15,281; makefile: 3; sh: 2
file content (12 lines) | stat: -rw-r--r-- 250 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
from apischema import deserialize, deserializer


@deserializer
class Foo:
    def __init__(self, bar: int) -> None:
        self.bar = bar


def test_type_converter():
    foo = deserialize(Foo, 42)
    assert isinstance(foo, Foo) and foo.bar == 42