Closed as not planned
Description
- cattrs version: 24.1.2
- Python version: 3.11
- Operating System: Linux
Description
import attrs, cattrs
@attrs.define
class Test:
a: int
b: str
cattrs.structure({"a": "hello", "b": "world"}, Test)
The expected traceback is the following:
+ Exception Group Traceback (most recent call last):
| File "/tmp/test_cattrs.py", line 8, in <module>
| cattrs.structure({"a": "hello", "b": "world"}, Test)
| File "<redacted>/lib/python3.11/site-packages/cattrs/converters.py", line 558, in structure
| return self._structure_func.dispatch(cl)(obj, cl)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "<cattrs generated structure __main__.Test>", line 14, in structure_Test
| cattrs.errors.ClassValidationError: While structuring Test (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "<cattrs generated structure __main__.Test>", line 5, in structure_Test
| ValueError: invalid literal for int() with base 10: 'hello'
| Structuring class Test @ attribute a
+------------------------------------
The following code is expected to raise an error:
Edit
When turning off detailed_validation
, the error message is the expected one:
Metadata
Metadata
Assignees
Labels
No labels