Skip to content

Commit 5fd1c7f

Browse files
committed
Fix namedtuple validation test
1 parent fca1f95 commit 5fd1c7f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

tests/test_tuples.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namedtuple_dict_unstructure_factory,
1212
)
1313
from cattrs.converters import Converter
14-
from cattrs.errors import ForbiddenExtraKeysError
14+
from cattrs.errors import ClassValidationError, ForbiddenExtraKeysError
1515

1616

1717
def test_simple_hetero_tuples(genconverter: Converter):
@@ -158,14 +158,11 @@ class Test(NamedTuple):
158158
# But explicitly enable it in the factory.
159159
c.register_structure_hook_factory(
160160
lambda t: t is Test,
161-
lambda t, conv: namedtuple_dict_structure_factory(
162-
t, conv, detailed_validation=True
163-
),
161+
lambda t, conv: namedtuple_dict_structure_factory(t, conv, True),
164162
)
165163

166164
# With detailed validation, structuring errors should be wrapped
167165
# in a ClassValidationError instead of being raised directly.
168-
from cattrs.errors import ClassValidationError
169166

170167
with raises(ClassValidationError):
171168
c.structure({"a": "not_an_int"}, Test)

0 commit comments

Comments
 (0)