# Path: tests/entities.py
# class DataClassIntImmutableDefault(DataClassJsonMixin):
#     x: int = 0
# 
# class DataClassMutableDefaultDict(DataClassJsonMixin):
#     xs: Dict[str, int] = field(default_factory=dict)
# 
# class DataClassMutableDefaultList(DataClassJsonMixin):
#     xs: List[int] = field(default_factory=list)
# 
# class DataClassWithDeque(DataClassJsonMixin):
#     xs: Deque[int]
# 
# class DataClassWithDict(DataClassJsonMixin):
#     kvs: Dict[str, str]
# 
# class DataClassWithDictInt(DataClassJsonMixin):
#     kvs: Dict[int, str]
# 
# class DataClassWithFrozenSet(DataClassJsonMixin):
#     xs: FrozenSet[int]
# 
# class DataClassWithList(DataClassJsonMixin):
#     xs: List[int]
# 
# class DataClassWithListStr(DataClassJsonMixin):
#     xs: List[str]
# 
# class DataClassWithMyCollection(DataClassJsonMixin):
#     xs: MyCollection[int]
# 
# class DataClassWithOptional(DataClassJsonMixin):
#     x: Optional[int]
# 
# class DataClassWithOptionalStr(DataClassJsonMixin):
#     x: Optional[str] = None
# 
# class DataClassWithSet(DataClassJsonMixin):
#     xs: Set[int]
# 
# class DataClassWithTuple(DataClassJsonMixin):
#     xs: Tuple[int]
# 
# class DataClassWithUnionIntNone(DataClassJsonMixin):
#     x: Union[int, None]
# 
# class MyCollection(Collection[A]):
#     def __init__(self, xs: Collection[A]) -> None:
#         self.xs = xs
# 
#     def __contains__(self, item):
#         return False
# 
#     def __iter__(self):
#         return iter(self.xs)
# 
#     def __len__(self):
#         return len(self.xs)
# 
#     def __eq__(self, other):
#         return type(self) == type(other) and self.xs == other.xs


from collections import deque
from tests.entities import (DataClassIntImmutableDefault,
                            DataClassMutableDefaultDict,
                            DataClassMutableDefaultList, DataClassWithDeque,
                            DataClassWithDict, DataClassWithDictInt,
                            DataClassWithFrozenSet, DataClassWithList,
                            DataClassWithListStr, DataClassWithMyCollection,
                            DataClassWithOptional, DataClassWithOptionalStr,
                            DataClassWithSet, DataClassWithTuple,
                            DataClassWithUnionIntNone, MyCollection)
        assert (DataClassWithSet.from_json('{"xs": [1]}') ==
                DataClassWithSet({1}))

    def test_tuple(self):
        assert (DataClassWithTuple.from_json('{"xs": [1]}') ==
                DataClassWithTuple((1,)))

    def test_frozenset(self):
        assert (DataClassWithFrozenSet.from_json('{"xs": [1]}') ==
                DataClassWithFrozenSet(frozenset([1])))

    def test_deque(self):
        assert (DataClassWithDeque.from_json('{"xs": [1]}') ==
                DataClassWithDeque(deque([1])))

    def test_optional(self):
        assert (DataClassWithOptional.from_json('{"x": 1}') ==
                DataClassWithOptional(1))
        assert (DataClassWithOptional.from_json('{"x": null}') ==
                DataClassWithOptional(None))

    def test_optional_str(self):
        assert (DataClassWithOptionalStr.from_json('{"x": "1"}') ==
                DataClassWithOptionalStr("1"))
        assert (DataClassWithOptionalStr.from_json('{"x": null}') ==
                DataClassWithOptionalStr(None))
        assert (DataClassWithOptionalStr.from_json('{}', infer_missing=True) ==
                DataClassWithOptionalStr())

    def test_my_collection(self):

# Path: tests/entities.py
# class DataClassIntImmutableDefault(DataClassJsonMixin):
#     x: int = 0
# 
# class DataClassMutableDefaultDict(DataClassJsonMixin):
#     xs: Dict[str, int] = field(default_factory=dict)
# 
# class DataClassMutableDefaultList(DataClassJsonMixin):
#     xs: List[int] = field(default_factory=list)
# 
# class DataClassWithDeque(DataClassJsonMixin):
#     xs: Deque[int]
# 
# class DataClassWithDict(DataClassJsonMixin):
#     kvs: Dict[str, str]
# 
# class DataClassWithDictInt(DataClassJsonMixin):
#     kvs: Dict[int, str]
# 
# class DataClassWithFrozenSet(DataClassJsonMixin):
#     xs: FrozenSet[int]
# 
# class DataClassWithList(DataClassJsonMixin):
#     xs: List[int]
# 
# class DataClassWithListStr(DataClassJsonMixin):
#     xs: List[str]
# 
# class DataClassWithMyCollection(DataClassJsonMixin):
#     xs: MyCollection[int]
# 
# class DataClassWithOptional(DataClassJsonMixin):
#     x: Optional[int]
# 
# class DataClassWithOptionalStr(DataClassJsonMixin):
#     x: Optional[str] = None
# 
# class DataClassWithSet(DataClassJsonMixin):
#     xs: Set[int]
# 
# class DataClassWithTuple(DataClassJsonMixin):
#     xs: Tuple[int]
# 
# class DataClassWithUnionIntNone(DataClassJsonMixin):
#     x: Union[int, None]
# 
# class MyCollection(Collection[A]):
#     def __init__(self, xs: Collection[A]) -> None:
#         self.xs = xs
# 
#     def __contains__(self, item):
#         return False
# 
#     def __iter__(self):
#         return iter(self.xs)
# 
#     def __len__(self):
#         return len(self.xs)
# 
#     def __eq__(self, other):
#         return type(self) == type(other) and self.xs == other.xs


# Path: tests/test_collections.py
from collections import deque
from tests.entities import (DataClassIntImmutableDefault,
                            DataClassMutableDefaultDict,
                            DataClassMutableDefaultList, DataClassWithDeque,
                            DataClassWithDict, DataClassWithDictInt,
                            DataClassWithFrozenSet, DataClassWithList,
                            DataClassWithListStr, DataClassWithMyCollection,
                            DataClassWithOptional, DataClassWithOptionalStr,
                            DataClassWithSet, DataClassWithTuple,
                            DataClassWithUnionIntNone, MyCollection)

        assert (DataClassWithSet.from_json('{"xs": [1]}') ==
                DataClassWithSet({1}))

    def test_tuple(self):
        assert (DataClassWithTuple.from_json('{"xs": [1]}') ==
                DataClassWithTuple((1,)))

    def test_frozenset(self):
        assert (DataClassWithFrozenSet.from_json('{"xs": [1]}') ==
                DataClassWithFrozenSet(frozenset([1])))

    def test_deque(self):
        assert (DataClassWithDeque.from_json('{"xs": [1]}') ==
                DataClassWithDeque(deque([1])))

    def test_optional(self):
        assert (DataClassWithOptional.from_json('{"x": 1}') ==
                DataClassWithOptional(1))
        assert (DataClassWithOptional.from_json('{"x": null}') ==
                DataClassWithOptional(None))

    def test_optional_str(self):
        assert (DataClassWithOptionalStr.from_json('{"x": "1"}') ==
                DataClassWithOptionalStr("1"))
        assert (DataClassWithOptionalStr.from_json('{"x": null}') ==
                DataClassWithOptionalStr(None))
        assert (DataClassWithOptionalStr.from_json('{}', infer_missing=True) ==
                DataClassWithOptionalStr())

    def test_my_collection(self):

        assert (DataClassWithMyCollection.from_json('{"xs": [1]}') ==