Skip to content

Commit

Permalink
Update package description.
Browse files Browse the repository at this point in the history
  • Loading branch information
wyfo committed Sep 23, 2020
1 parent 57fb36f commit 751cd61
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apischema/dataclasses/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def _serialization(

def _deserialization_merged_aliases(cls: Type) -> AbstractSet[str]:
"""Return all aliases used in cls deserialization."""
cls = getattr(cls, "__origin__", cls)
cls = getattr(cls, "__origin__", None) or cls
types = get_type_hints(cls, include_extras=True)
result: Set[str] = set()
for field in fields_items(cls).values():
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.7.6

- Update package description.

## 0.7.5

- Fix support of `Generic` merged dataclasses.
Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

setup(
name="apischema",
version="0.7.5",
version="0.7.6",
url="https://github.com/wyfo/apischema",
author="Joseph Perez",
author_email="[email protected]",
license="MIT",
packages=find_packages(include=["apischema*"]),
package_data={"apischema": ["py.typed"]},
description="Another Python API schema handling and JSON (de)serialization "
"through typing annotation; light, simple, powerful.",
description="JSON (de)serialization + schema generation through python typing, with a spoonful of sugar.", # noqa E501
long_description=README,
long_description_content_type="text/markdown",
python_requires=">=3.6",
Expand Down
37 changes: 37 additions & 0 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from dataclasses import InitVar, dataclass, field
from typing import Generic, TypeVar

from apischema.dataclasses.cache import _deserialization_merged_aliases
from apischema.metadata import merged


@dataclass
class A:
a: int
b: "B" = field(metadata=merged)
c: "C[int]" = field(metadata=merged)
d: "D" = field(metadata=merged)
e: InitVar[int]
f: int = field(init=False)


@dataclass
class B:
g: int


T = TypeVar("T")


@dataclass
class C(Generic[T]):
h: T


@dataclass
class D(Generic[T]):
i: T


def test_merged_aliases():
assert _deserialization_merged_aliases(A) == {"a", "g", "h", "i", "e"}

0 comments on commit 751cd61

Please sign in to comment.