Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

Commit

Permalink
Add frozenset to FIELD_CLASS_MAP
Browse files Browse the repository at this point in the history
  • Loading branch information
rossmacarthur committed Feb 16, 2020
1 parent 9c740a5 commit 24d7c0e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/serde/fields.py
Expand Up @@ -1260,6 +1260,7 @@ def validate(self, value):
complex: Complex,
dict: Dict,
float: Float,
frozenset: FrozenSet,
int: Int,
list: List,
set: Set,
Expand Down
17 changes: 17 additions & 0 deletions tests/test_meta.py
Expand Up @@ -5,6 +5,7 @@

import mock

from serde import fields
from tests import REPO_DIR, py36


Expand Down Expand Up @@ -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

0 comments on commit 24d7c0e

Please sign in to comment.