Skip to content

Commit 08a3bd0

Browse files
committed
Fix broken unittests
1 parent aff1a99 commit 08a3bd0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: src/cattr/converters.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def _structure_default(self, obj, cl):
305305
"Unsupported type: {0}. Register a structure hook for "
306306
"it.".format(cl)
307307
)
308-
raise ValueError(msg)
308+
raise StructureHandlerNotFoundError(msg)
309309

310310
@staticmethod
311311
def _structure_call(obj, cl):

Diff for: tests/test_structure.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from cattr import Converter
3434
from cattr._compat import is_bare, is_union_type
3535
from cattr.converters import NoneType
36+
from cattr.errors import StructureHandlerNotFoundError
3637

3738
from . import (
3839
dicts_of_primitives,
@@ -326,9 +327,9 @@ def test_structuring_enums(data, enum):
326327
def test_structuring_unsupported():
327328
"""Loading unsupported classes should throw."""
328329
converter = Converter()
329-
with raises(ValueError):
330+
with raises(StructureHandlerNotFoundError):
330331
converter.structure(1, Converter)
331-
with raises(ValueError):
332+
with raises(StructureHandlerNotFoundError):
332333
converter.structure(1, Union[int, str])
333334

334335

0 commit comments

Comments
 (0)