diff --git a/src/serde/fields.py b/src/serde/fields.py index 5051f21..94665b1 100644 --- a/src/serde/fields.py +++ b/src/serde/fields.py @@ -1260,6 +1260,7 @@ def validate(self, value): complex: Complex, dict: Dict, float: Float, + frozenset: FrozenSet, int: Int, list: List, set: Set, diff --git a/tests/test_meta.py b/tests/test_meta.py index 8a304fc..e07d09b 100644 --- a/tests/test_meta.py +++ b/tests/test_meta.py @@ -5,6 +5,7 @@ import mock +from serde import fields from tests import REPO_DIR, py36 @@ -60,3 +61,19 @@ def module_from_path(p): ] for module in [module_from_path(f) for f in filenames]: exec ('from {} import *'.format(module), {}, {}) # noqa: E211 + + +def test_field_class_map(): + """ + Check that all Instance type fields are in the FIELD_CLASS_MAP. + """ + for name in fields.__all__: + field_cls = getattr(fields, name) + if fields.is_subclass(field_cls, fields.Instance): + try: + ty = field_cls().ty + except TypeError: + pass + else: + msg = '{!r} not in FIELD_CLASS_MAP'.format(ty.__name__) + assert ty in fields.FIELD_CLASS_MAP, msg