Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type hints with ellipsis fails to serialize #16

Closed
sveinse opened this issue Jan 4, 2020 · 1 comment
Closed

Type hints with ellipsis fails to serialize #16

sveinse opened this issue Jan 4, 2020 · 1 comment

Comments

@sveinse
Copy link
Collaborator

sveinse commented Jan 4, 2020

Running 32-bit Py 3.8.0 on Win10. desert from master, commit 073a40e

desert does not support types with ellipsis, which is used to indicate a variable length list or tuple with homogeneous types. The following test case:

def test_tuple_ellipsis(module):
    """Test tuple with ellipsis"""

    @module.dataclass
    class A:
        x: t.Tuple[int, ...]

    schema = desert.schema_class(A)()
    dumped = {"x": (1, 2, 3)}
    loaded = A(x=(1, 2, 3))

    assert schema.load(dumped) == loaded
    assert schema.dump(loaded) == dumped
    assert schema.loads(schema.dumps(loaded)) == loaded

Fails on making the schema with:

src\desert\_make.py:107: in class_schema
    raise desert.exceptions.UnknownType(
E   desert.exceptions.UnknownType: Desert failed to infer the field type for Ellipsis.
E   Explicitly pass a Marshmallow field type.
@python-desert
Copy link
Collaborator

Thanks for the test. This is fixed in v2019.01.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant