Type hints with ellipsis fails to serialize
sveinse opened this issue · comments
Svein Seldal commented
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.
Deleted user commented
Thanks for the test. This is fixed in v2019.01.04.