diff --git a/databind/src/databind/json/converters.py b/databind/src/databind/json/converters.py index 880723b..2d4a16f 100644 --- a/databind/src/databind/json/converters.py +++ b/databind/src/databind/json/converters.py @@ -2,7 +2,6 @@ import datetime import decimal import enum -from types import NoneType import typing as t from typeapi import ( @@ -395,7 +394,7 @@ class PlainDatatypeConverter(Converter): (int, float): float, (float, int): _int_lossless, (bool, bool): bool, - (NoneType, NoneType): lambda x: x, + (type(None), type(None)): lambda x: x, } # Used only during deserialization if the #fieldinfo.strict is disabled. @@ -408,7 +407,7 @@ class PlainDatatypeConverter(Converter): (int, str): str, (float, str): str, (bool, str): str, - (NoneType, NoneType): lambda x: x, + (type(None), type(None)): lambda x: x, } ) diff --git a/databind/src/databind/json/tests/converters_test.py b/databind/src/databind/json/tests/converters_test.py index 0fe1792..9ef970f 100644 --- a/databind/src/databind/json/tests/converters_test.py +++ b/databind/src/databind/json/tests/converters_test.py @@ -3,7 +3,6 @@ import decimal import enum import sys -from types import NoneType import typing as t import uuid from collections import namedtuple @@ -80,7 +79,7 @@ def test_plain_datatype_converter(direction: Direction) -> None: mapper.convert(direction, "foobar", int) # None should behave the same in both cases - assert mapper.convert(direction, None, NoneType) is None + assert mapper.convert(direction, None, type(None)) is None assert mapper.convert(direction, None, None) is None