cattrs
cattrs copied to clipboard
Tuple[A, B] can be structured from a list with less than two values
- cattrs version: 0.9.0
- Python version: 3.7.2
- Operating System: Win 10 x64
Description
When structuring a list using the type Tuple[float, float], cattrs will happily construct a tuple from a list with less than two values. I was expecting an error instead. Is this intentional?
What I Did
In [17]: from typing import Tuple
In [18]: cattr.structure([1,2], Tuple[float, float])
Out[18]: (1.0, 2.0)
In [19]: cattr.structure([1], Tuple[float, float])
Out[19]: (1.0,)
In [20]: cattr.structure([], Tuple[float, float])
Out[20]: ()
Not intentional. Will take a PR if it's simple to fix :)